azureapiazure-functionsazure-web-app-servicegoogle-nearby

How to retrieve all results from NearBySearch on Azure?


I am using NearBySearch from Microsoft Azure. In the official documentation it says that when you make a query the totalResults that the API can return is X. However, you can also read that there is a limit on the number of items returned which is at most 100.

In the case that the totalResults >= limit == 100, the API will only display the first 100 results, thus not showing the remaining ones.

Question: Would you be able to suggest a way to retrieve the additional results using the NearBySearch function?

Note: On the Google API NearBySearch there is a parameter called next_page_token, which allows to view all the possible results. Is there something similar in Azure?


Solution

  • You have a limit of 100 results each query. If you have 150 totalResults. You can execute the query with ofs= 0 and limit= 100 to get the first 100 entries. After that you execute the second query with the ofs=100 (because it is like an index). Your limit is 100. After that you will get the next 100 results. Because there are only 50 results left, your numResults will be 50.

    I hope it is understandable