locked
Custom order by distance RRS feed

  • Question

  • I am trying to use Azure Seach to search for records with multiple locations (total of 3). Each location is a field of Edm.GeographyPoint. I can order by a single point using:

    $orderby=geo.distance(point1,geography'POINT(-0.910053 51.955428)')

    Would it be possible to consider point2 and point3 and get the closest point to be considered in order by clause?


    Friday, August 17, 2018 3:14 PM

Answers

  • You could sort by distance from one of the points, using the other points as tie-breakers, but if I understand correctly this is not what you're trying to do. You want to sort by the minimum of the distances from three different points. Is that correct?

    If so, then no, this is not possible today. Azure Search does not support arbitrary calculations in the $orderby parameter.

    Wednesday, August 22, 2018 9:45 PM
    Moderator

All replies

  • You could sort by distance from one of the points, using the other points as tie-breakers, but if I understand correctly this is not what you're trying to do. You want to sort by the minimum of the distances from three different points. Is that correct?

    If so, then no, this is not possible today. Azure Search does not support arbitrary calculations in the $orderby parameter.

    Wednesday, August 22, 2018 9:45 PM
    Moderator
  • You could sort by distance from one of the points, using the other points as tie-breakers, but if I understand correctly this is not what you're trying to do. You want to sort by the minimum of the distances from three different points. Is that correct?

    If so, then no, this is not possible today. Azure Search does not support arbitrary calculations in the $orderby parameter.

    Do you know if there are plans to accept GeographyMultiPoint?
    Saturday, September 1, 2018 10:23 PM
  • There are currently no plans to support GeographyMultiPoint and I don't see any requests for it on User Voice (feel free to add one). Can you elaborate on how you think this would help with your scenario? Note that the standard OData geo.distance function only takes GeographyPoint, not GeographyMultiPoint.

    Monday, September 3, 2018 6:31 PM
    Moderator