public class RecursivePrefixTreeStrategy extends PrefixTreeStrategy
PrefixTreeStrategy
which uses AbstractVisitingPrefixTreeQuery
.
This strategy has support for searching non-point shapes (note: not tested).
Even a query shape with distErrPct=0 (fully precise to the grid) should have
good performance for typical data, unless there is a lot of indexed data
coincident with the shape's edge.Modifier and Type | Field and Description |
---|---|
protected boolean |
multiOverlappingIndexedShapes |
protected int |
prefixGridScanLevel |
protected boolean |
pruneLeafyBranches |
defaultFieldValuesArrayLen, distErrPct, FIELD_TYPE, grid, pointsOnly
ctx
Constructor and Description |
---|
RecursivePrefixTreeStrategy(SpatialPrefixTree grid,
String fieldName) |
Modifier and Type | Method and Description |
---|---|
protected Iterator<Cell> |
createCellIteratorToIndex(org.locationtech.spatial4j.shape.Shape shape,
int detailLevel,
Iterator<Cell> reuse) |
int |
getPrefixGridScanLevel() |
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.
|
boolean |
isMultiOverlappingIndexedShapes() |
boolean |
isPruneLeafyBranches() |
protected Query |
makeGridShapeIntersectsQuery(org.locationtech.spatial4j.shape.Shape gridShape)
makeQuery(SpatialArgs) specialized for the query being a grid square. |
Query |
makeQuery(SpatialArgs args)
|
void |
setMultiOverlappingIndexedShapes(boolean multiOverlappingIndexedShapes)
|
void |
setPrefixGridScanLevel(int prefixGridScanLevel)
Sets the grid level [1-maxLevels] at which indexed terms are scanned brute-force
instead of by grid decomposition.
|
void |
setPruneLeafyBranches(boolean pruneLeafyBranches)
An optional hint affecting non-point shapes and tree cells implementing
CellCanPrune , otherwise
ignored. |
String |
toString() |
calcFacets, createIndexableFields, createIndexableFields, createIndexableFields, getDistErrPct, getGrid, isPointShape, isPointsOnly, makeDistanceValueSource, newCellToBytesRefIterator, setDefaultFieldValuesArrayLen, setDistErrPct, setPointsOnly
getFieldName, getSpatialContext, makeDistanceValueSource, makeRecipDistanceValueSource
protected int prefixGridScanLevel
protected boolean pruneLeafyBranches
protected boolean multiOverlappingIndexedShapes
public RecursivePrefixTreeStrategy(SpatialPrefixTree grid, String fieldName)
public int getPrefixGridScanLevel()
public void setPrefixGridScanLevel(int prefixGridScanLevel)
prefixGridScanLevel
- 1 to maxLevelspublic boolean isMultiOverlappingIndexedShapes()
public void setMultiOverlappingIndexedShapes(boolean multiOverlappingIndexedShapes)
public boolean isPruneLeafyBranches()
public void setPruneLeafyBranches(boolean pruneLeafyBranches)
CellCanPrune
, otherwise
ignored.
It will prune away a complete set sibling leaves to their parent (recursively), resulting in ~20-50% fewer indexed cells, and consequently that much less disk and that much faster indexing. So if it's a quad tree and all 4 sub-cells are there marked as a leaf, then they will be removed (pruned) and the parent is marked as a leaf instead. This occurs recursively on up. Unfortunately, the current implementation will buffer all cells to do this, so consider disabling for high precision (low distErrPct) shapes. (default=true)
public String toString()
toString
in class SpatialStrategy
protected Iterator<Cell> createCellIteratorToIndex(org.locationtech.spatial4j.shape.Shape shape, int detailLevel, Iterator<Cell> reuse)
createCellIteratorToIndex
in class PrefixTreeStrategy
public Query makeQuery(SpatialArgs args)
SpatialStrategy
SpatialOperation
and Shape
from the supplied args
. It should be constant scoring of 1.makeQuery
in class SpatialStrategy
protected boolean isGridAlignedShape(org.locationtech.spatial4j.shape.Shape shape)
protected Query makeGridShapeIntersectsQuery(org.locationtech.spatial4j.shape.Shape gridShape)
makeQuery(SpatialArgs)
specialized for the query being a grid square.Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.