How can I sort results, first by some numeric field (for example by price) then by distance when using GEOFILTER in RediSearch?
You can do this with an aggregation. See the geodistance function here: https://oss.redis.com/redisearch/Aggregations/#list_of_geo_apply_functions
You’ll need to have the numeric field and the output of the geodistance function in your SORTBY clause.
Thanks. I already figured it out while my post was waiting for approval (~1 month). I do have a follow up question however.
As I need to use LOAD with aggregation and there’s a warning in documentation about a LOAD’s performance impact, I am wondering which of two options is better for performance.
Option 1: LOAD all fields that are needed for filtering in aggregation and fields that I need in results.
Option 2: LOAD only fields that are needed for filtering in aggregation and then use HMGET for each doc-key returned from aggregation to get fields that I need in results.
I use aggregation like a advanced query (without any aggregation function), to get individual documents.