Return select 查询中 geo.distance 函数的值

Return Value from geo.distance function in a select query

我正在使用 select 来查询索引。我想 return 索引中的 GeographyPoint 的距离。我正在尝试这样的事情: 其中 GeoPoint 是位置字段

$select=ID,geo.distance(GeoPoint, geography'POINT(-122.131577 47.678581)')

如果你有纬度、经度和位置,有没有办法在 Select 语句中 return 距离?

谢谢!

我什至希望它能起作用

但是您不能直接使用'select'获取距离。它目前仅作为过滤器和 orderby 属性 启用。

'SELECT' 只能用于字段名称

Azure 搜索目前不支持在搜索响应中返回 geo.distance 的结果。请为功能投票 on User Voice 以帮助我们确定优先级。

作为解决方法,您可以自己计算距离。 This forum thread and this answer 描述几种方法。