Package org.apache.lucene.spatial.prefix
Class NumberRangePrefixTreeStrategy
java.lang.Object
org.apache.lucene.spatial.SpatialStrategy
org.apache.lucene.spatial.prefix.PrefixTreeStrategy
org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy
org.apache.lucene.spatial.prefix.NumberRangePrefixTreeStrategy
A PrefixTree based on Number/Date ranges. This isn't very "spatial" on the surface (to the user)
but it's implemented using spatial so that's why it's here extending a SpatialStrategy. When
using this class, you will use various utility methods on the prefix tree implementation to
convert objects/strings to/from shapes.
To use with dates, pass in DateRangePrefixTree
.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Facet response informationNested classes/interfaces inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy
PrefixTreeStrategy.ShapeTokenStream
-
Field Summary
Fields inherited from class org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy
multiOverlappingIndexedShapes, prefixGridScanLevel, pruneLeafyBranches
Fields inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy
defaultFieldValuesArrayLen, distErrPct, FIELD_TYPE, grid, pointsOnly
Fields inherited from class org.apache.lucene.spatial.SpatialStrategy
ctx
-
Constructor Summary
ConstructorDescriptionNumberRangePrefixTreeStrategy
(NumberRangePrefixTree prefixTree, String fieldName) -
Method Summary
Modifier and TypeMethodDescriptioncalcFacets
(IndexReaderContext context, Bits topAcceptDocs, NumberRangePrefixTree.UnitNRShape start, NumberRangePrefixTree.UnitNRShape end) Calculates facets betweenstart
andend
to a detail level one greater than that provided by the arguments.calcFacets
(IndexReaderContext context, Bits topAcceptDocs, org.locationtech.spatial4j.shape.Shape facetRange, int level) Calculates facets (aggregated counts) given a range shape (start-end span) and a level, which specifies the detail.getGrid()
protected boolean
isGridAlignedShape
(org.locationtech.spatial4j.shape.Shape shape) A quick check of the shape to see if it is perfectly aligned to a grid.protected boolean
isPointShape
(org.locationtech.spatial4j.shape.Shape shape) Returns true if theshape
is aPoint
.makeDistanceValueSource
(org.locationtech.spatial4j.shape.Point queryPoint, double multiplier) Unsupported.Methods inherited from class org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy
createCellIteratorToIndex, getPrefixGridScanLevel, isMultiOverlappingIndexedShapes, isPruneLeafyBranches, makeGridShapeIntersectsQuery, makeQuery, setMultiOverlappingIndexedShapes, setPrefixGridScanLevel, setPruneLeafyBranches, toString
Methods inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy
calcFacets, createIndexableFields, createIndexableFields, createIndexableFields, getDistErrPct, isPointsOnly, newCellToBytesRefIterator, setDefaultFieldValuesArrayLen, setDistErrPct, setPointsOnly, tokenStream
Methods inherited from class org.apache.lucene.spatial.SpatialStrategy
getFieldName, getSpatialContext, makeDistanceValueSource, makeRecipDistanceValueSource
-
Constructor Details
-
NumberRangePrefixTreeStrategy
-
-
Method Details
-
getGrid
- Overrides:
getGrid
in classPrefixTreeStrategy
-
isPointShape
protected boolean isPointShape(org.locationtech.spatial4j.shape.Shape shape) Description copied from class:PrefixTreeStrategy
Returns true if theshape
is aPoint
. For custom spatial contexts, it may make sense to have certain other shapes return true.- Overrides:
isPointShape
in classPrefixTreeStrategy
-
isGridAlignedShape
protected boolean isGridAlignedShape(org.locationtech.spatial4j.shape.Shape shape) Description copied from class:RecursivePrefixTreeStrategy
A quick check of the shape to see if it is perfectly aligned to a grid. Points always are as they are indivisible. It's okay to return false if the shape actually is aligned; this is an optimization hint.- Overrides:
isGridAlignedShape
in classRecursivePrefixTreeStrategy
-
makeDistanceValueSource
public DoubleValuesSource makeDistanceValueSource(org.locationtech.spatial4j.shape.Point queryPoint, double multiplier) Unsupported.- Overrides:
makeDistanceValueSource
in classPrefixTreeStrategy
-
calcFacets
public NumberRangePrefixTreeStrategy.Facets calcFacets(IndexReaderContext context, Bits topAcceptDocs, NumberRangePrefixTree.UnitNRShape start, NumberRangePrefixTree.UnitNRShape end) throws IOException Calculates facets betweenstart
andend
to a detail level one greater than that provided by the arguments. For example providing March to October of 2014 would return facets to the day level of those months. This is just a convenience method.- Throws:
IOException
- See Also:
-
calcFacets
public NumberRangePrefixTreeStrategy.Facets calcFacets(IndexReaderContext context, Bits topAcceptDocs, org.locationtech.spatial4j.shape.Shape facetRange, int level) throws IOException Calculates facets (aggregated counts) given a range shape (start-end span) and a level, which specifies the detail. To get the level of an existing shape, say a Calendar, callNumberRangePrefixTree.toUnitShape(Object)
then callNumberRangePrefixTree.UnitNRShape.getLevel()
. Facet computation is implemented by navigating the underlying indexed terms efficiently.- Throws:
IOException
-