Package org.apache.lucene.search
Interface MatchesIterator
- All Known Subinterfaces:
IntervalMatchesIterator
- All Known Implementing Classes:
CachingMatchesIterator,ConjunctionIntervalsSource.ConjunctionMatchesIterator,ConjunctionIntervalsSource.SingletonMatchesIterator,DisjunctionIntervalsSource.DisjunctionMatchesIterator,DisjunctionMatchesIterator,DisjunctionMatchesIterator.TermsEnumDisjunctionMatchesIterator,FilterMatchesIterator,MinimizingConjunctionMatchesIterator,MinimumShouldMatchIntervalsSource.MinimumMatchesIterator,RepeatingIntervalsSource.DuplicateMatchesIterator,TermMatchesIterator
public interface MatchesIterator
An iterator over match positions (and optionally offsets) for a single document and field
To iterate over the matches, call
next() until it returns false, retrieving
positions and/or offsets after each call. You should not call the position or offset methods
before next() has been called, or after next() has returned false.
Matches from some queries may span multiple positions. You can retrieve the positions of
individual matching terms on the current match by calling getSubMatches().
Matches are ordered by start position, and then by end position. Match intervals may overlap.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintThe ending offset of the current match, or-1if offsets are not available Should only be called afternext()has returnedtrueintThe end position of the current match Should only be called afternext()has returnedtruegetQuery()Returns the Query causing the current match If thisMatchesIteratorhas been returned from agetSubMatches()call, then returns aTermQueryequivalent to the current match Should only be called afternext()has returnedtrueReturns a MatchesIterator that iterates over the positions and offsets of individual terms within the current match Returnsnullif there are no submatches (ie the current iterator is at the leaf level) Should only be called afternext()has returnedtruebooleannext()Advance the iterator to the next match positionintThe starting offset of the current match, or-1if offsets are not available Should only be called afternext()has returnedtrueintThe start position of the current match Should only be called afternext()has returnedtrue
-
Method Details
-
next
Advance the iterator to the next match position- Returns:
trueif matches have not been exhausted- Throws:
IOException
-
startPosition
int startPosition()The start position of the current match Should only be called afternext()has returnedtrue -
endPosition
int endPosition()The end position of the current match Should only be called afternext()has returnedtrue -
startOffset
The starting offset of the current match, or-1if offsets are not available Should only be called afternext()has returnedtrue- Throws:
IOException
-
endOffset
The ending offset of the current match, or-1if offsets are not available Should only be called afternext()has returnedtrue- Throws:
IOException
-
getSubMatches
Returns a MatchesIterator that iterates over the positions and offsets of individual terms within the current match Returnsnullif there are no submatches (ie the current iterator is at the leaf level) Should only be called afternext()has returnedtrue- Throws:
IOException
-
getQuery
Query getQuery()Returns the Query causing the current match If thisMatchesIteratorhas been returned from agetSubMatches()call, then returns aTermQueryequivalent to the current match Should only be called afternext()has returnedtrue
-