visual_chefs_zach
visual_chefs_zach

Reputation: 61

Google custom search api returns different total results on different pages

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?).

Upvotes: 6

Views: 2903

Answers (1)

Sudeep
Sudeep

Reputation: 349

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.

Upvotes: 2

Related Questions