Class PrefixTreeStrategy

    • Field Detail

      • defaultFieldValuesArrayLen

        protected int defaultFieldValuesArrayLen
      • distErrPct

        protected double distErrPct
      • pointsOnly

        protected boolean pointsOnly
      • FIELD_TYPE

        public static final FieldType FIELD_TYPE
    • Method Detail

      • getDistErrPct

        public double getDistErrPct()
      • setDistErrPct

        public void setDistErrPct​(double distErrPct)
        The default measure of shape precision affecting shapes at index and query times. Points don't use this as they are always indexed at the configured maximum precision (SpatialPrefixTree.getMaxLevels()); this applies to all other shapes. Specific shapes at index and query time can use something different than this default value. If you don't set a default then the default is SpatialArgs.DEFAULT_DISTERRPCT -- 2.5%.
        See Also:
        SpatialArgs.getDistErrPct()
      • isPointsOnly

        public boolean isPointsOnly()
      • setPointsOnly

        public void setPointsOnly​(boolean pointsOnly)
        True if only indexed points shall be supported. There are no "leafs" in such a case, except those at maximum precision.
      • createIndexableFields

        public Field[] createIndexableFields​(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.
      • createIndexableFields

        public Field[] createIndexableFields​(Shape shape,
                                             int detailLevel)
      • makeDistanceValueSource

        public DoubleValuesSource makeDistanceValueSource​(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
      • isPointShape

        protected boolean isPointShape​(Shape shape)
        Returns true if the shape is a Point. For custom spatial contexts, it may make sense to have certain other shapes return true.