aroundRadius vs aroundPrecision

Hi guys,
I have a question regarding Algolia’s geolocation configuration.
Filtering by aroundLatLng doesn’t seem to work unless we specify aroundRadius value in Algolia’s instantsearch configure component, even we add aroundPrecision it doesn’t take it in account, we’re getting all the hits back from Algolia.

My question is could we adjust aroundRadius dynamically to increase the radius? or can we combine it with aroundPrecision for this purpose?


Hi @najoua.chlouchi

There’s a lot of good details in this page: aroundLatLng API parameter | Algolia

While reading that page keep in mind the difference between filtering and ranking. Filtering removes records from the result set, while ranking adjusts the ordering of the results.

aroundRadius and minimumAroundRadius are used for filtering. We will only return records that fit within the defined circle. If you don’t specify the radius, we will select and arbitrary radius based on the density of records in your index. You can also specify any to disable geographic filtering.

aroundPrecision is used for ranking. If you have Geo turned on as a ranking criteria (which should be true by default), we assign each record a numeric geo value based on its distance from the aroundLatLng point and the precision used to use these as a ranking criteria (so a record that is 200 meters away will rank lower than a record that is 50 meters away).

aroundPrecision allows you to define the size of bands that will be used for this ranking. By default those bands are 10 meters, meaning records that are within 10 meters of each other are considered of equal ranking. Increasing this value means records within larger distances would be grouped together.

You could change the radius dynamically be modifying the configuration for your search client and re-running the query, but you may get better results by allowing Algolia to define the radius automatically based on record density. If you’re getting all of your records back, it could be there aren’t enough records near that location based on density,

Thank you @chuck.meyer for the details, we’ve imported data to our site around 9460 records, although I’m still getting all the hits back if the radius is not configured from our end, just wondering how much data we should have indexed to Algolia in order to get a dynamic radius filter.
Thanks again for all your help in this.