- 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 BytesRefIteratorasBytesRefIterator(List<Term> terms) intThe ending offset of the current match, or-1if offsets are not availableintThe end position of the current match, or-1if positions are not available(package private) static MatchesIterator(package private) static MatchesIteratorCreate aDisjunctionMatchesIteratorover a list of terms(package private) static MatchesIteratorfromTermsEnum(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) Create aDisjunctionMatchesIteratorover a list of terms extracted from aBytesRefIteratorgetQuery()Returns the Query causing the current matchReturns a MatchesIterator that iterates over the positions and offsets of individual terms within the current matchbooleannext()Advance the iterator to the next match positionintThe starting offset of the current match, or-1if offsets are not availableintThe start position of the current match, or-1if positions are not available
-
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 aDisjunctionMatchesIteratorover 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 aDisjunctionMatchesIteratorover a list of terms extracted from aBytesRefIteratorOnly terms that have at least one match in the given document will be included
- Throws:
IOException
-
fromSubIterators
- Throws:
IOException
-
next
Description copied from interface:MatchesIteratorAdvance the iterator to the next match position- Specified by:
nextin interfaceMatchesIterator- Returns:
trueif matches have not been exhausted- Throws:
IOException
-
startPosition
public int startPosition()Description copied from interface:MatchesIteratorThe start position of the current match, or-1if positions are not availableShould only be called after
MatchesIterator.next()has returnedtrue- Specified by:
startPositionin interfaceMatchesIterator
-
endPosition
public int endPosition()Description copied from interface:MatchesIteratorThe end position of the current match, or-1if positions are not availableShould only be called after
MatchesIterator.next()has returnedtrue- Specified by:
endPositionin interfaceMatchesIterator
-
startOffset
Description copied from interface:MatchesIteratorThe starting offset of the current match, or-1if offsets are not availableShould only be called after
MatchesIterator.next()has returnedtrue- Specified by:
startOffsetin interfaceMatchesIterator- Throws:
IOException
-
endOffset
Description copied from interface:MatchesIteratorThe ending offset of the current match, or-1if offsets are not availableShould only be called after
MatchesIterator.next()has returnedtrue- Specified by:
endOffsetin interfaceMatchesIterator- Throws:
IOException
-
getSubMatches
Description copied from interface:MatchesIteratorReturns a MatchesIterator that iterates over the positions and offsets of individual terms within the current matchReturns
nullif there are no submatches (ie the current iterator is at the leaf level)Should only be called after
MatchesIterator.next()has returnedtrue- Specified by:
getSubMatchesin interfaceMatchesIterator- Throws:
IOException
-
getQuery
Description copied from interface:MatchesIteratorReturns the Query causing the current matchIf this
MatchesIteratorhas been returned from aMatchesIterator.getSubMatches()call, then returns aTermQueryequivalent to the current matchShould only be called after
MatchesIterator.next()has returnedtrue- Specified by:
getQueryin interfaceMatchesIterator
-