#community-help

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
Feb 22, 2023 (10 months ago)
Priyank
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Priyank
09:45 AM
Hi , 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
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:31 AM
No it can be done only during sorting. Otherwise you have to do it client side.
Priyank
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Priyank
11:58 AM
I 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
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:59 AM
Is there a reason that you are not able to add it as the last sorting field after your other sort criteria?