Reputation: 610
I found that nearby search returns inconsistent results.
I ran this query one day (go client lib). It returned me 4 results. Given
keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&location=1.2564%2C103.8189&rankby=distance&type=lodging
https://gist.github.com/haibin/20e01d38c10d4da9275439c549a2db91
I ran this query another day (go client lib). It returned me 5 results. Given
keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&language=en&location=1.2564%2C103.8189&rankby=distance&type=lodging
https://gist.github.com/haibin/b40e4952b7fddace78d6c37a19542a40
I ran this query today (curl). It returned me 1 result. Given
keyword=Resorts%20World%20Sentosa%20Equarius%208%20Sentosa%20Gateway&language=en&location=1.2564%2C103.8189&rankby=distance&type=lodging
https://gist.github.com/haibin/a65a6d03ace05898913e306840307bdb
Any idea why?
Upvotes: 5
Views: 756
Reputation: 2741
Possibly there was a bug in google places API when using rankby=distance
parameter it skips some result or search in "limited radius"
As when I ran curl with these params
https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=MY_KEY&keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&location=1.2564%2C103.8189&rankby=distance&type=lodging
it returned only one result as u said.
But when i ran with radius param it returns more results as accepted
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=1.2564,103.8189&type=lodging&keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&key=MY_KEY&radius=300
You are getting more results through go lib because probably they fixed it in that or something like that
For more info you can go through these issues:
Google Places API nearby search rankby distance skipping some nearest places
Hope this will help you.
Upvotes: 2