Class IntervalIterator
- java.lang.Object
-
- org.apache.lucene.search.DocIdSetIterator
-
- org.apache.lucene.queries.intervals.IntervalIterator
-
- Direct Known Subclasses:
IntervalFilter
public abstract class IntervalIterator extends DocIdSetIterator
ADocIdSetIteratorthat also allows iteration over matching intervals in a document. Once the iterator is positioned on a document by callingDocIdSetIterator.advance(int)orDocIdSetIterator.nextDoc(), intervals may be retrieved by callingnextInterval()untilNO_MORE_INTERVALSis returned. The limits of the current interval are returned bystart()andend(). When the iterator has been moved to a new document, but beforenextInterval()has been called, both these methods return-1. Note that it is possible for a document to returnNO_MORE_INTERVALSon the first call tonextInterval()
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_MORE_INTERVALSWhen returned fromnextInterval(), indicates that there are no more matching intervals on the current document-
Fields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS
-
-
Constructor Summary
Constructors Constructor Description IntervalIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intend()The end of the current interval Returns -1 ifnextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted.abstract intgaps()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 floatmatchCost()An indication of the average cost of iterating over all intervals in a documentabstract intnextInterval()Advance the iterator to the next intervalabstract intstart()The start of the current interval Returns -1 ifnextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted.StringtoString()intwidth()The width of the current interval-
Methods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, cost, docID, empty, nextDoc, range, slowAdvance
-
-
-
-
Field Detail
-
NO_MORE_INTERVALS
public static final int NO_MORE_INTERVALS
When returned fromnextInterval(), indicates that there are no more matching intervals on the current document- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public abstract int start()
The start of the current interval Returns -1 ifnextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted.
-
end
public abstract int end()
The end of the current interval Returns -1 ifnextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted.
-
gaps
public 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. Should not be called beforenextInterval(), or after it has returnedNO_MORE_INTERVALS
-
width
public int width()
The width of the current interval
-
nextInterval
public abstract int nextInterval() throws IOExceptionAdvance the iterator to the next interval- Returns:
- the start of the next interval, or
NO_MORE_INTERVALSif there are no more intervals on the current document - Throws:
IOException
-
matchCost
public abstract float matchCost()
An indication of the average cost of iterating over all intervals in a document- See Also:
TwoPhaseIterator.matchCost()
-
-