Calculating Distance Between User and Search Result Location
TLDR Priyank wants to calculate distance between user and search location. Kishore Nallan suggests it can only be done during sorting or client side, but the issue remains unresolved.
Powered by Struct AI
4
10mo
Feb 22, 2023 (10 months ago)
Priyank
Priyank
09:45 AMHi , is there a way to get the distance calculated between user location and search result location ? currently only if i apply geo location based sorting or filter then only it provides me "geo_distance_meters" field, but i want this field at all times even if i don't apply geolocation based filter or sorting parameter
Kishore Nallan
Kishore Nallan
11:31 AMNo it can be done only during sorting. Otherwise you have to do it client side.
Priyank
Priyank
11:58 AMI have multiple documents and have to calculate the distance for each one so it's taking longer response time, so if you provide this distance field according to the requirement then it might benefit in this use case just a suggestion
Kishore Nallan
Kishore Nallan
11:59 AMIs there a reason that you are not able to add it as the last sorting field after your other sort criteria?
Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
Indexed 3011 threads (79% resolved)
Similar Threads
Resolving Geo-Distance Issue in Search Query Results
Guillermo and Andrew wanted to know individual distance of results when filtering by geopoint. Kishore Nallan advised checking 'geo_distance_meters' in the search response and ensure 'sort_by' clause is present in the query.
14
17mo
Solved
Getting Document Distance without Filters
TJ asked about getting document distance without filters. Jason suggested using geosort to obtain the distance.
3
5mo
Solved
Combining Sorting Parameters in GeoSearch
chase asked if sorting parameters could be combined in geosearch. Jason suggested using the `precision` parameter for this purpose.
5
3mo
Solved