Return Value from geo.distance function in a select query

血红的双手。 提交于 2019-12-11 08:04:21

问题


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, geography'POINT(-122.131577 47.678581)')

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

Thanks!


回答1:


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.




回答2:


Even I wished it would work

But you cannot directly get the distance by using 'select'. It is currently enabled only as a filter and orderby property.

'SELECT' can be used only on the field names



来源:https://stackoverflow.com/questions/51484560/return-value-from-geo-distance-function-in-a-select-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!