在 Azure 搜索中对作为集合的子实体执行 geo.distance 筛选
Performing geo.distance Filter in Azure Search on a SubEntity That is a Collection
我正在尝试将 geo.distance 筛选器应用于 Azure 搜索中的搜索查询。复杂的部分是我过滤的 属性 在一个集合中,如下所示。
我在搜索资源管理器中尝试了以下语法:
$filter=geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)')) le 1000
但我收到以下错误:
“无效表达式:')'或','预计在'geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)中的第39位')) le 1000'.\r\nParameter 名称:$filter
知道如何正确地表达这个以获得期望的结果吗?
any
量词需要应用于集合。在您的示例中,集合是 Location
字段,因此如果您想要一个过滤器 returns 记录 Location 中的任何元素在参考点 1000 公里以内的位置:
$filter=Location/any(loc: geo.distance(loc/GeoPoint, geography'POINT(-122.131577 47.678581)') le 1000)
我正在尝试将 geo.distance 筛选器应用于 Azure 搜索中的搜索查询。复杂的部分是我过滤的 属性 在一个集合中,如下所示。
我在搜索资源管理器中尝试了以下语法:
$filter=geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)')) le 1000
但我收到以下错误:
“无效表达式:')'或','预计在'geo.distance(Location/any(l: l/GeoPoint,geography'POINT(-122.131577 47.678581)中的第39位')) le 1000'.\r\nParameter 名称:$filter
知道如何正确地表达这个以获得期望的结果吗?
any
量词需要应用于集合。在您的示例中,集合是 Location
字段,因此如果您想要一个过滤器 returns 记录 Location 中的任何元素在参考点 1000 公里以内的位置:
$filter=Location/any(loc: geo.distance(loc/GeoPoint, geography'POINT(-122.131577 47.678581)') le 1000)