0
votes

I'm trying to apply a geo.distance filter to a search query in Azure Search. The complicated part is that the property I'm filtering on is within a collection as shown below.

enter image description here

I tried the following syntax from Search Explorer:

$filter=geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)')) le 1000

but I get the following error:

"Invalid expression: ')' or ',' expected at position 39 in 'geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)')) le 1000'.\r\nParameter name: $filter"

Any idea how to formulate this correctly to get the desired results?

1

1 Answers

0
votes

The any quantifier needs to be applied to the collection. In your example, the collection is the Location field, so if you want a filter that returns documents where any of the elements in Location is within 1000 km of your reference point:

$filter=Location/any(loc: geo.distance(loc/GeoPoint, geography'POINT(-122.131577 47.678581)') le 1000)