Class IntervalIterator
- Direct Known Subclasses:
IntervalFilter
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()
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intWhen returned fromnextInterval(), indicates that there are no more matching intervals on the current documentFields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intend()The end of the current intervalabstract intgaps()The number of gaps within the current intervalabstract floatAn indication of the average cost of iterating over all intervals in a documentabstract intAdvance the iterator to the next intervalabstract intstart()The start of the current intervaltoString()intwidth()The width of the current intervalMethods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, cost, docID, docIDRunEnd, empty, intoBitSet, nextDoc, range, slowAdvance
-
Field Details
-
NO_MORE_INTERVALS
public static final int NO_MORE_INTERVALSWhen returned fromnextInterval(), indicates that there are no more matching intervals on the current document- See Also:
-
-
Constructor Details
-
IntervalIterator
public IntervalIterator()
-
-
Method Details
-
start
public abstract int start()The start of the current intervalReturns -1 if
nextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted. -
end
public abstract int end()The end of the current intervalReturns -1 if
nextInterval()has not yet been called andNO_MORE_INTERVALSonce the iterator is exhausted. -
gaps
public abstract int gaps()The number of gaps within the current intervalNote 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 before
nextInterval(), or after it has returnedNO_MORE_INTERVALS -
width
public int width()The width of the current interval -
nextInterval
Advance the iterator to the next intervalShould not be called after
DocIdSetIterator.NO_MORE_DOCSis returned byDocIdSetIterator.nextDoc()orDocIdSetIterator.advance(int). If that's the case in some existing code, please consider opening an issue. However, afterNO_MORE_INTERVALSis returned by this method, it might be called again.- 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:
-
toString
-