In the Google Custom Search API, it seems the "totalResults" field returned in the response.queries.request[0] object decreases on the last page of search results. For example, if a search comes up with 17 total results, and I send an identical request with "&start=11" appended, the value of "response.queries.request[0].totalResults" drops from 17 to 12.
I am not sure what causes this, or if its even on my end (Could Google be filtering out repeated entries after the fact?).
IF YOU ARE USING THE API Google Custom Search and Google Site Search return up to 10 results per query. If you want to display more than 10 results to the user, you can issue multiple requests (using the start=0, start=11 … parameters) and display the results on a single page.
Accessing Google's Custom Search JSON API requires the use of an API key. To get this key, navigate to the Custom Search JSON API page and click Get a Key. Choose an existing project, or create a new one, and click Next. Note and copy your API key.
It's not at your end, but an issue with Google itself. You can try the same query on Google directly and you will notice inconsistent total results towards the end of pagination. Not sure exactly why but this kind of issue is not unusual when you have a massive massive set of data to work with, processed parallelly across a massive infrastructure, and a large number of dynamic factors acting upon. Yes, could be repeated entries filtering, copyright removals etc etc.
If you are calculating your own start index then what you can do is adjust your start index if the new total result received is lower than your start index. But better to use the start index coming from the API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With