Package org.apache.lucene.search
Class DisjunctionMatchesIterator
java.lang.Object
org.apache.lucene.search.DisjunctionMatchesIterator
- All Implemented Interfaces:
MatchesIterator
A
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 available Should only be called afterMatchesIterator.next()has returnedtrueintThe end position of the current match Should only be called afterMatchesIterator.next()has returnedtrue(package private) static MatchesIterator(package private) static MatchesIteratorCreate aDisjunctionMatchesIteratorover a list of terms Only terms that have at least one match in the given document will be included(package private) static MatchesIteratorfromTermsEnum(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) Create aDisjunctionMatchesIteratorover a list of terms extracted from aBytesRefIteratorOnly terms that have at least one match in the given document will be includedgetQuery()Returns the Query causing the current match If thisMatchesIteratorhas been returned from aMatchesIterator.getSubMatches()call, then returns aTermQueryequivalent to the current match Should only be called afterMatchesIterator.next()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 afterMatchesIterator.next()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 afterMatchesIterator.next()has returnedtrueintThe start position of the current match Should only be called afterMatchesIterator.next()has returnedtrue
-
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 terms Only 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 Should only be called afterMatchesIterator.next()has returnedtrue- Specified by:
startPositionin interfaceMatchesIterator
-
endPosition
public int endPosition()Description copied from interface:MatchesIteratorThe end position of the current match Should only be called afterMatchesIterator.next()has returnedtrue- Specified by:
endPositionin interfaceMatchesIterator
-
startOffset
Description copied from interface:MatchesIteratorThe starting offset of the current match, or-1if offsets are not available Should only be called afterMatchesIterator.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 available Should only be called afterMatchesIterator.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 match Returnsnullif there are no submatches (ie the current iterator is at the leaf level) Should only be called afterMatchesIterator.next()has returnedtrue- Specified by:
getSubMatchesin interfaceMatchesIterator- Throws:
IOException
-
getQuery
Description copied from interface:MatchesIteratorReturns the Query causing the current match If thisMatchesIteratorhas been returned from aMatchesIterator.getSubMatches()call, then returns aTermQueryequivalent to the current match Should only be called afterMatchesIterator.next()has returnedtrue- Specified by:
getQueryin interfaceMatchesIterator
-