public abstract class AbstractVisitingPrefixTreeFilter.VisitorTemplate extends AbstractPrefixTreeFilter.BaseTermsEnumTraverser
SpatialPrefixTree
indexed field. An instance
of this class is not designed to be re-used across AtomicReaderContext
instances so simply create a new one for each call to, say a Filter.getDocIdSet(org.apache.lucene.index.AtomicReaderContext, org.apache.lucene.util.Bits)
.
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
OpenBitSet
. Then it starts the traversal
process, calling findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Node)
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
visit(org.apache.lucene.spatial.prefix.tree.Node)
is called. At
some depths, of the tree, the algorithm switches to a scanning mode that
finds calls visitScanned(org.apache.lucene.spatial.prefix.tree.Node, com.spatial4j.core.shape.Shape)
for each leaf cell found.Modifier and Type | Field and Description |
---|---|
protected boolean |
hasIndexedLeaves |
acceptDocs, context, docsEnum, maxDoc, termsEnum
Constructor and Description |
---|
AbstractVisitingPrefixTreeFilter.VisitorTemplate(AtomicReaderContext context,
Bits acceptDocs,
boolean hasIndexedLeaves) |
Modifier and Type | Method and Description |
---|---|
protected Iterator<Node> |
findSubCellsToVisit(Node cell)
Called when doing a divide & 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(AbstractVisitingPrefixTreeFilter.VNode vNode) |
protected void |
preSiblings(AbstractVisitingPrefixTreeFilter.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 boolean |
visit(Node cell)
Visit an indexed cell returned from
findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Node) . |
protected abstract void |
visitLeaf(Node cell)
Called after visit() returns true and an indexed leaf cell is found.
|
protected abstract void |
visitScanned(Node cell,
com.spatial4j.core.shape.Shape cellShape)
The cell is either indexed as a leaf or is the last level of detail.
|
collectDocs
public AbstractVisitingPrefixTreeFilter.VisitorTemplate(AtomicReaderContext context, Bits acceptDocs, boolean hasIndexedLeaves) throws IOException
IOException
public DocIdSet getDocIdSet() throws IOException
IOException
protected Iterator<Node> findSubCellsToVisit(Node 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.Node,
com.spatial4j.core.shape.Shape)
.IOException
protected abstract void start() throws IOException
IOException
protected abstract DocIdSet finish() throws IOException
IOException
protected abstract boolean visit(Node cell) throws IOException
findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Node)
.cell
- An intersecting cell.IOException
protected abstract void visitLeaf(Node cell) throws IOException
IOException
protected abstract void visitScanned(Node cell, com.spatial4j.core.shape.Shape cellShape) throws IOException
cellShape
instead of cell.getCellShape
for the cell's
shape.IOException
protected void preSiblings(AbstractVisitingPrefixTreeFilter.VNode vNode) throws IOException
IOException
protected void postSiblings(AbstractVisitingPrefixTreeFilter.VNode vNode) throws IOException
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.