Adrien Dos Reis
Adrien Dos Reis

Reputation: 517

Algolia Places REST API - Search around radius and fallback on the whole planet

Hi to the SO community !

I'm using Algolia Places to get some addresses to suggest to our end-users when they start to type their addresses in a field on our mobile-app. So far it works well, I'm able to get places from all around the world. But when I specify "aroundLatLng" and "aroundRadius" parameters, I just have a few places around the client's position. Based on the documentation :

If you specify an aroundLatLng query parameter or if your source IP address is geo-localized, results will be composed by: Places around you (<10km), Places in your country, Popular places all around the world.

I thought that specifying an "aroundRadius" parameter would just override the former "10km" default value, and still show some places from my country. In fact, it seems that specifying this parameter overrides completely the default fallback behavior which searches all over my country if it can't find anything relevant around me.

Is there any way to tell Algolia Places to increase the "10km" default radius while keeping the default behavior ? (i.e. still searching everywhere in my country)

Thanks a lot for your help !

Upvotes: 0

Views: 267

Answers (1)

Raphi
Raphi

Reputation: 121

Places team here 👋

aroundLatLng will just bias the results, to get a better relevancy of the results for this specific user. If we can't locate it or if there isn't any match, we will always return results anyway. See this a small weight on results around the user.

Whereas aroundRadius is a filter, meaning that we will only search and return results inside the radius area with aroundLatLng as the center.

There is no way to change the value of this '10km' "weight" since it's the inner workings of the algorithm. And by experience, this is more than enough to provide relevant results.

Let me know if it makes sense and if you have other questions!

Upvotes: 1

Related Questions