Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.spatial.prefix
Class AbstractVisitingPrefixTreeFilter.VisitorTemplate

    java.lang.Object
      org.apache.lucene.spatial.prefix.AbstractPrefixTreeFilter.BaseTermsEnumTraverser
          org.apache.lucene.spatial.prefix.AbstractVisitingPrefixTreeFilter.VisitorTemplate

Enclosing class:
  AbstractVisitingPrefixTreeFilter

    public abstract class AbstractVisitingPrefixTreeFilter.VisitorTemplate

extends AbstractPrefixTreeFilter.BaseTermsEnumTraverser

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.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 `visit(org.apache.lucene.spatial.prefix.tree.Cell)` 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.Cell)` for each leaf cell found.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

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<Cell>` | `findSubCellsToVisit(Cell 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(Cell cell)` Visit an indexed cell returned from `findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Cell)`.
`protected abstract void` | `visitLeaf(Cell cell)` Called after visit() returns true and an indexed leaf cell is found.
`protected abstract void` | `visitScanned(Cell cell)` 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

### hasIndexedLeaves

    protected final boolean hasIndexedLeaves

Constructor Detail

### AbstractVisitingPrefixTreeFilter.VisitorTemplate

    public AbstractVisitingPrefixTreeFilter.VisitorTemplate(AtomicReaderContext context,
                                                            Bits acceptDocs,
                                                            boolean hasIndexedLeaves)
                                                     throws IOException

Throws:
  `IOException`

Method Detail

### getDocIdSet

    public DocIdSet getDocIdSet()
                         throws IOException

  Throws:
    `IOException`

### findSubCellsToVisit

    protected Iterator<Cell> findSubCellsToVisit(Cell cell)

  Called when doing a divide & conquer to find the next intersecting cells of the query shape that are beneath `cell`. `cell` is guaranteed to have an intersection and thus this must return some number of nodes.

### scan

    protected void scan(int scanDetailLevel)
                 throws IOException

  Scans (`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)`.

  Throws:
    `IOException`

### start

    protected abstract void start()
                           throws IOException

  Called first to setup things.

  Throws:
    `IOException`

### finish

    protected abstract DocIdSet finish()
                                throws IOException

  Called last to return the result.

  Throws:
    `IOException`

### visit

    protected abstract boolean visit(Cell cell)
                              throws IOException

  Visit an indexed cell returned from `findSubCellsToVisit(org.apache.lucene.spatial.prefix.tree.Cell)`.

  Parameters:
    `cell` - An intersecting cell.
  Returns:
    true to descend to more levels. It is an error to return true if cell.level == detailLevel
  Throws:
    `IOException`

### visitLeaf

    protected abstract void visitLeaf(Cell cell)
                               throws IOException

  Called after visit() returns true and an indexed leaf cell is found. An indexed leaf cell means associated documents generally won't be found at further detail levels.

  Throws:
    `IOException`

### visitScanned

    protected abstract void visitScanned(Cell cell)
                                  throws IOException

  The cell is either indexed as a leaf or is the last level of detail. It might not even intersect the query shape, so be sure to check for that.

  Throws:
    `IOException`

### preSiblings

    protected void preSiblings(AbstractVisitingPrefixTreeFilter.VNode vNode)
                        throws IOException

  Throws:
    `IOException`

### postSiblings

    protected void postSiblings(AbstractVisitingPrefixTreeFilter.VNode vNode)
                         throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.