- All Implemented Interfaces:
MatchesIterator
MatchesIterator
that combines matches from a set of sub-iterators
Matches are sorted by their start positions, and then by their end positions, so that prefixes sort first. Matches may overlap, or be duplicated if they appear in more than one of the sub-iterators.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BytesRefIterator
asBytesRefIterator
(List<Term> terms) int
The ending offset of the current match, or-1
if offsets are not availableint
The end position of the current match(package private) static MatchesIterator
(package private) static MatchesIterator
Create aDisjunctionMatchesIterator
over a list of terms(package private) static MatchesIterator
fromTermsEnum
(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) Create aDisjunctionMatchesIterator
over a list of terms extracted from aBytesRefIterator
getQuery()
Returns the Query causing the current matchReturns a MatchesIterator that iterates over the positions and offsets of individual terms within the current matchboolean
next()
Advance the iterator to the next match positionint
The starting offset of the current match, or-1
if offsets are not availableint
The start position of the current match
-
Field Details
-
queue
-
started
private boolean started
-
-
Constructor Details
-
DisjunctionMatchesIterator
- Throws:
IOException
-
-
Method Details
-
fromTerms
static MatchesIterator fromTerms(LeafReaderContext context, int doc, Query query, String field, List<Term> terms) throws IOException Create aDisjunctionMatchesIterator
over a list of termsOnly terms that have at least one match in the given document will be included
- Throws:
IOException
-
asBytesRefIterator
-
fromTermsEnum
static MatchesIterator fromTermsEnum(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) throws IOException Create aDisjunctionMatchesIterator
over a list of terms extracted from aBytesRefIterator
Only terms that have at least one match in the given document will be included
- Throws:
IOException
-
fromSubIterators
- Throws:
IOException
-
next
Description copied from interface:MatchesIterator
Advance the iterator to the next match position- Specified by:
next
in interfaceMatchesIterator
- Returns:
true
if matches have not been exhausted- Throws:
IOException
-
startPosition
public int startPosition()Description copied from interface:MatchesIterator
The start position of the current matchShould only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
startPosition
in interfaceMatchesIterator
-
endPosition
public int endPosition()Description copied from interface:MatchesIterator
The end position of the current matchShould only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
endPosition
in interfaceMatchesIterator
-
startOffset
Description copied from interface:MatchesIterator
The starting offset of the current match, or-1
if offsets are not availableShould only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
startOffset
in interfaceMatchesIterator
- Throws:
IOException
-
endOffset
Description copied from interface:MatchesIterator
The ending offset of the current match, or-1
if offsets are not availableShould only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
endOffset
in interfaceMatchesIterator
- Throws:
IOException
-
getSubMatches
Description copied from interface:MatchesIterator
Returns a MatchesIterator that iterates over the positions and offsets of individual terms within the current matchReturns
null
if there are no submatches (ie the current iterator is at the leaf level)Should only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
getSubMatches
in interfaceMatchesIterator
- Throws:
IOException
-
getQuery
Description copied from interface:MatchesIterator
Returns the Query causing the current matchIf this
MatchesIterator
has been returned from aMatchesIterator.getSubMatches()
call, then returns aTermQuery
equivalent to the current matchShould only be called after
MatchesIterator.next()
has returnedtrue
- Specified by:
getQuery
in interfaceMatchesIterator
-