org.apache.lucene.spatial.vector

Class PointVectorStrategy



  • public class PointVectorStrategy
    extends SpatialStrategy
    Simple SpatialStrategy which represents Points in two numeric fields. The Strategy's best feature is decent distance sort.

    Characteristics:

    • Only indexes points; just one per field value.
    • Can query by a rectangle or circle.
    • SpatialOperation.Intersects and SpatialOperation.IsWithin is supported.
    • Requires DocValues for #makeDistanceValueSource(org.locationtech.spatial4j.shape.Point) and for searching with a Circle.

    Implementation:

    This is a simple Strategy. Search works with a pair of range queries on two DoublePoints representing x & y fields. A Circle query does the same bbox query but adds a ValueSource filter on #makeDistanceValueSource(org.locationtech.spatial4j.shape.Point).

    One performance shortcoming with this strategy is that a scenario involving both a search using a Circle and sort will result in calculations for the spatial distance being done twice -- once for the filter and second for the sort.