public abstract class AbstractVisitingPrefixTreeQuery.VisitorTemplate extends AbstractPrefixTreeQuery.BaseTermsEnumTraverser
SpatialPrefixTree
indexed field. An instance
of this class is not designed to be re-used across LeafReaderContext
instances so simply create a new one per-leaf.
The getDocIdSet()
method here starts the work. It first checks
that there are indexed terms; if not it quickly returns null. Then it calls
start()
so a subclass can set up a return value, like an
FixedBitSet
. Then it starts the traversal
process, calling findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Cell)
which by default finds the top cells that intersect queryShape
. If
there isn't an indexed cell for a corresponding cell returned for this
method then it's short-circuited until it finds one, at which point
visitPrefix(org.apache.lucene.spatial.prefix.tree.Cell)
is called. At
some depths, of the tree, the algorithm switches to a scanning mode that
calls visitScanned(org.apache.lucene.spatial.prefix.tree.Cell)
for each leaf cell found.context, maxDoc, postingsEnum, terms, termsEnum
Constructor and Description |
---|
VisitorTemplate(LeafReaderContext context) |
Modifier and Type | Method and Description |
---|---|
protected CellIterator |
findSubCellsToVisit(Cell cell)
Called when doing a divide and conquer to find the next intersecting cells
of the query shape that are beneath
cell . |
protected abstract DocIdSet |
finish()
Called last to return the result.
|
DocIdSet |
getDocIdSet() |
protected void |
postSiblings(AbstractVisitingPrefixTreeQuery.VNode vNode) |
protected void |
preSiblings(AbstractVisitingPrefixTreeQuery.VNode vNode) |
protected void |
scan(int scanDetailLevel)
Scans (
termsEnum.next() ) terms until a term is found that does
not start with curVNode's cell. |
protected abstract void |
start()
Called first to setup things.
|
protected abstract void |
visitLeaf(Cell cell)
Called when an indexed leaf cell is found.
|
protected abstract boolean |
visitPrefix(Cell cell)
Visit an indexed non-leaf cell.
|
protected void |
visitScanned(Cell cell)
The cell is either indexed as a leaf or is the last level of detail.
|
collectDocs, collectDocs
public VisitorTemplate(LeafReaderContext context) throws IOException
IOException
public DocIdSet getDocIdSet() throws IOException
IOException
protected CellIterator findSubCellsToVisit(Cell cell)
cell
. cell
is
guaranteed to have an intersection and thus this must return some number
of nodes.protected void scan(int scanDetailLevel) throws IOException
termsEnum.next()
) terms until a term is found that does
not start with curVNode's cell. If it finds a leaf cell or a cell at
level scanDetailLevel
then it calls visitScanned(org.apache.lucene.spatial.prefix.tree.Cell)
.IOException
protected abstract void start() throws IOException
IOException
protected abstract DocIdSet finish() throws IOException
IOException
protected abstract boolean visitPrefix(Cell cell) throws IOException
Cell.getShapeRel()
set
relative to the filtered shape.cell
- An intersecting cell; not a leaf.IOException
protected abstract void visitLeaf(Cell cell) throws IOException
IOException
protected void visitScanned(Cell cell) throws IOException
visitLeaf(org.apache.lucene.spatial.prefix.tree.Cell)
or
visitPrefix(org.apache.lucene.spatial.prefix.tree.Cell)
.IOException
protected void preSiblings(AbstractVisitingPrefixTreeQuery.VNode vNode) throws IOException
IOException
protected void postSiblings(AbstractVisitingPrefixTreeQuery.VNode vNode) throws IOException
IOException
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.