Class PointVectorStrategy

    • Constructor Detail

      • PointVectorStrategy

        public PointVectorStrategy​(org.locationtech.spatial4j.context.SpatialContext ctx,
                                   String fieldNamePrefix,
                                   FieldType fieldType)
        Create a new instance configured with the provided FieldType options. See DEFAULT_FIELDTYPE. a field type is used to articulate the desired options (namely pointValues, docValues, stored). Legacy numerics is configurable this way too.
    • Method Detail

      • createIndexableFields

        public Field[] createIndexableFields​(org.locationtech.spatial4j.shape.Shape shape)
        Description copied from class: SpatialStrategy
        Returns the IndexableField(s) from the shape that are to be added to the Document. These fields are expected to be marked as indexed and not stored.

        Note: If you want to store the shape as a string for retrieval in search results, you could add it like this:

        document.add(new StoredField(fieldName,ctx.toString(shape)));
        The particular string representation used doesn't matter to the Strategy since it doesn't use it.
        Specified by:
        createIndexableFields in class SpatialStrategy
        Returns:
        Not null nor will it have null elements.
      • makeDistanceValueSource

        public DoubleValuesSource makeDistanceValueSource​(org.locationtech.spatial4j.shape.Point queryPoint,
                                                          double multiplier)
        Description copied from class: SpatialStrategy
        Make a ValueSource returning the distance between the center of the indexed shape and queryPoint. If there are multiple indexed shapes then the closest one is chosen. The result is multiplied by multiplier, which conveniently is used to get the desired units.
        Specified by:
        makeDistanceValueSource in class SpatialStrategy