The Discourse API gem is using the /search/query route. It doesn’t seem to respond to pagination. The Discourse UI uses the /search route. It does respond to pagination.
You can test this in your browser by going to http://forum.example.com/search.json?q=test and then trying http://forum.example.com/search.json?q=test&page=2
You might need to find a way to make the API call without using the Discourse API gem. If your goal is to get all the topics and posts on your site, using the /search route doesn’t seem like the best approach.
You might try making an API call to http://forum.example.com/c/your-category-slug.json. If all topics for the category are not returned in the request, the request’s topic_list will have a more_topics_url property that will give you the route to the next page of topics. That will look something like "/c/site-feedback?page=2". You’ll need to add .json to the URL to get the JSON data (/c/site-feedback.json?page=2).