从select查询中的geo.distance函数返回值

从select查询中的geo.distance函数返回值

问题描述:

我正在玩选择查询索引.我想返回索引中有一个GeographyPoint的距离.我正在尝试这样的事情: 其中GeoPoint是位置字段

I was playing around with the select for querying the index. I wanted to return a distance for a GeographyPoint I have in the index. I was trying something like this: where GeoPoint is the location field

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

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

如果您有纬度和经度以及位置,是否可以通过Select语句返回距离?

Is there a way to return distance in a Select statement if you have the lat and long and the location?

谢谢!

Azure Search当前不支持在搜索响应中返回geo.distance的结果.请对该功能进行投票在用户语音中以帮助我们确定优先级.

Azure Search does not currently support returning the result of geo.distance in the search response. Please vote for the feature on User Voice to help us prioritize.

作为一种解决方法,您可以自己计算距离. 此答案描述了实现此目的的几种方法.

As a workaround, you can calculate the distance yourself. This forum thread and this answer describe a few ways to do this.