Support for Geo.distance function on customer location compared to index data
We have clients that we want to expose using the search feature. They do not want to appear if customer is outside there catchment area.
The Geo.Distance function can only be compared to fixed data.
I'd like to compare this with data held in the index.

Thank you for your feedback. While it is unlikely we’ll address this suggestion in the near future, we’ll reassess based on the number of votes it receives.
Thanks,
Mike
Azure Search Product Team
6 comments
-
Jeff commented
We have this exact same situation and it would seem like a common one.
Service providers have a "home" location and a radius they are willing to travel to provide such service. Users are searching for a provider whom is willing to travel to them for service. The travel distance is stored in the index. Thus something like
geo.distance(location1, POINT(-127.89734578345 45.234534534)) lt serviceRadiusField
is what would be required.Currently we have to just use a really large radius and filter results on our own. This also makes paging more difficult.
-
[Deleted User] commented
I have a good example which is similar. We have a location and radius in the index (radius in meters). I want to be able to filter the results where the distance from index location to passed in location is less than the indexed radius.
-
Bruce Johnston commented
@Pablo J: There is no update at this time.
Implementing this is actually not as easy as it looks. The difficulty is in the fact that we rely on one of the parameters being constant for the purposes of lookup in the inverted index. It isn't clear to us how to implement this efficiently enough to meet typical expectations of query performance.
Right now we're focusing on items with many more votes than this, but if this gets enough votes we'll revisit it.
-
Pablo J commented
any update on this?
it doesn't *seem* like a huge change and there are plenty of valid use cases.
-
Ian Powell commented
This one :
geo.distance(location1, POINT(-127.89734578345 45.234534534)) lt distanceField
-
Bruce Johnston - MSFT commented
To clarify, is the functionality you're looking for this:
geo.distance(location1, location2) lt 100
where "location1" and "location2" are fields in the same index, or more like this:
geo.distance(location1, POINT(-127.89734578345 45.234534534)) lt distanceField
where "distanceField" is a numeric field in the same index?