public abstract class IntervalIterator extends DocIdSetIterator
DocIdSetIterator that also allows iteration over matching
intervals in a document.
Once the iterator is positioned on a document by calling DocIdSetIterator.advance(int)
or DocIdSetIterator.nextDoc(), intervals may be retrieved by calling nextInterval()
until NO_MORE_INTERVALS is returned.
The limits of the current interval are returned by start() and end().
When the iterator has been moved to a new document, but before nextInterval()
has been called, both these methods return -1.
Note that it is possible for a document to return NO_MORE_INTERVALS
on the first call to nextInterval()| Modifier and Type | Field and Description |
|---|---|
static int |
NO_MORE_INTERVALS
When returned from
nextInterval(), indicates that there are no more
matching intervals on the current document |
NO_MORE_DOCS| Constructor and Description |
|---|
IntervalIterator() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
end()
The end of the current interval
Returns -1 if
nextInterval() has not yet been called and NO_MORE_INTERVALS
once the iterator is exhausted. |
abstract int |
gaps()
The number of gaps within the current interval
Note that this returns the number of gaps between the immediate sub-intervals
of this interval, and does not include the gaps inside those sub-intervals.
|
abstract float |
matchCost()
An indication of the average cost of iterating over all intervals in a document
|
abstract int |
nextInterval()
Advance the iterator to the next interval
|
abstract int |
start()
The start of the current interval
Returns -1 if
nextInterval() has not yet been called and NO_MORE_INTERVALS
once the iterator is exhausted. |
String |
toString() |
int |
width()
The width of the current interval
|
advance, all, cost, docID, empty, nextDoc, range, slowAdvancepublic static final int NO_MORE_INTERVALS
nextInterval(), indicates that there are no more
matching intervals on the current documentpublic abstract int start()
nextInterval() has not yet been called and NO_MORE_INTERVALS
once the iterator is exhausted.public abstract int end()
nextInterval() has not yet been called and NO_MORE_INTERVALS
once the iterator is exhausted.public abstract int gaps()
nextInterval(), or after it has returned
NO_MORE_INTERVALSpublic int width()
public abstract int nextInterval()
throws IOException
NO_MORE_INTERVALS if
there are no more intervals on the current documentIOExceptionpublic abstract float matchCost()
TwoPhaseIterator.matchCost()Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.