|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.spatial.prefix.AbstractPrefixTreeFilter.BaseTermsEnumTraverser org.apache.lucene.spatial.prefix.AbstractVisitingPrefixTreeFilter.VisitorTemplate
public abstract class AbstractVisitingPrefixTreeFilter.VisitorTemplate
An abstract class designed to make it easy to implement predicates or
other operations on a 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.
Field Summary | |
---|---|
protected boolean |
hasIndexedLeaves
|
Fields inherited from class org.apache.lucene.spatial.prefix.AbstractPrefixTreeFilter.BaseTermsEnumTraverser |
---|
acceptDocs, context, docsEnum, maxDoc, termsEnum |
Constructor Summary | |
---|---|
AbstractVisitingPrefixTreeFilter.VisitorTemplate(AtomicReaderContext context,
Bits acceptDocs,
boolean hasIndexedLeaves)
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.lucene.spatial.prefix.AbstractPrefixTreeFilter.BaseTermsEnumTraverser |
---|
collectDocs |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean hasIndexedLeaves
Constructor Detail |
---|
public AbstractVisitingPrefixTreeFilter.VisitorTemplate(AtomicReaderContext context, Bits acceptDocs, boolean hasIndexedLeaves) throws IOException
IOException
Method Detail |
---|
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |