Sort results by geo radius ASC/DESC


does anyone know if and how to do a Sort (ASC/DESC) on the field “_geoloc”?

The default behavior is always Ascending when searching with passed coordinates.

Have looked at the topic “Ranking and Sorting” and already implemented (example: entry date ASC/DESC).

Created a new replica for sorting, but now the question is, what do I do with the “geo” entry in the “Ranking Criteria”, do I remove it?

And what do I have to do then, create a key “geo” under “Add sort-by attribute” or with the object “_geoloc”?

Hi @dev24

In order to sort geographically, we need a relevant geolocation to sort against. You do this by setting the aroundLatLng parameter with a set of coordinates. If you’re just looking to do geographic sorting and not filtering, you should set the aroundRadius parameter to any – that way all records will be sorted based on geographic proximity to the coordinates you supplied.

This is a good guide as well: