public interface MatchesIterator
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.Weight.matches(LeafReaderContext, int)
Modifier and Type | Method and Description |
---|---|
int |
endOffset()
The ending offset of the current match, or
-1 if offsets are not available
Should only be called after next() has returned true |
int |
endPosition()
The end position of the current match
Should only be called after
next() has returned true |
Query |
getQuery()
Returns the Query causing the current match
If this
MatchesIterator has been returned from a getSubMatches()
call, then returns a TermQuery equivalent to the current match
Should only be called after next() has returned true |
MatchesIterator |
getSubMatches()
Returns a MatchesIterator that iterates over the positions and offsets of individual
terms within the current match
Returns
null if there are no submatches (ie the current iterator is at the
leaf level)
Should only be called after next() has returned true |
boolean |
next()
Advance the iterator to the next match position
|
int |
startOffset()
The starting offset of the current match, or
-1 if offsets are not available
Should only be called after next() has returned true |
int |
startPosition()
The start position of the current match
Should only be called after
next() has returned true |
boolean next() throws IOException
true
if matches have not been exhaustedIOException
int startPosition()
next()
has returned true
int endPosition()
next()
has returned true
int startOffset() throws IOException
-1
if offsets are not available
Should only be called after next()
has returned true
IOException
int endOffset() throws IOException
-1
if offsets are not available
Should only be called after next()
has returned true
IOException
MatchesIterator getSubMatches() throws IOException
null
if there are no submatches (ie the current iterator is at the
leaf level)
Should only be called after next()
has returned true
IOException
Query getQuery()
MatchesIterator
has been returned from a getSubMatches()
call, then returns a TermQuery
equivalent to the current match
Should only be called after next()
has returned true
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.