Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1273

Improve usability and consistency of spatial API

    Details

      Description

      SpatialContext has two methods: onDefaultCoordinates() and onCoordinates(String), the first one makes it easy for simple cases, but DistanceSortField constructors must know the spatial field name (you can't create one for the default coordinates). I suggest to add DistanceSortField(Point) and DistanceSortField(double, double) which act on default coordinates.

      Same for FullTextQuery.setSpatialParameters(Point, String) and FullTextQuery.setSpatialParameters(double, double, String). There should be FullTextQuery.setSpatialParameters(Point) and FullTextQuery.setSpatialParameters(double, double).

      I would like to reuse distance computation in my own code: if my entity implements Coordinates and I have a Point origin, I would like to be able to call origin.getDistanceTo(myEntity) but Point.getDistanceTo() takes a Point, not a Coordinates. I suggest to change Point.getDistanceTo(Point other) to Point.getDistanceTo(Coordinates other).

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                hardy.ferentschik Hardy Ferentschik
                Reporter:
                kalgon Xavier Dury
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: