Class NumberRangePrefixTree

  • Direct Known Subclasses:
    DateRangePrefixTree

    public abstract class NumberRangePrefixTree
    extends SpatialPrefixTree
    A SpatialPrefixTree for single-dimensional numbers and number ranges of fixed precision values (not floating point). Despite its name, the indexed values (and queries) need not actually be ranges, they can be unit instance/values.

    Why might you use this instead of Lucene's built-in integer/long support? Here are some reasons with features based on code in this class, or are possible based on this class but require a subclass to fully realize it.

    • Index ranges, not just unit instances. This is especially useful when the requirement calls for a multi-valued range.
    • Instead of a fixed "precisionStep", this prefixTree can have a customizable number of child values for any prefix (up to 32768). This allows exact alignment of the prefix-tree with typical/expected values, which results in better performance. For example in a Date implementation, every month can get its own dedicated prefix, every day, etc., even though months vary in duration.
    • Arbitrary precision, like BigDecimal.
    • Standard Lucene integer/long indexing always indexes the full precision of those data types but this one is customizable.
    Unlike "normal" spatial components in this module, this special-purpose one only works with Shapes created by the methods on this class, not from any SpatialContext.
    See Also:
    NumberRangePrefixTreeStrategy, LUCENE-5648
    WARNING: This API is experimental and might change in incompatible ways in the next release.