final class DisjunctionMatchesIterator extends java.lang.Object implements 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.Modifier and Type | Field and Description |
---|---|
private PriorityQueue<MatchesIterator> |
queue |
private boolean |
started |
Modifier | Constructor and Description |
---|---|
private |
DisjunctionMatchesIterator(java.util.List<MatchesIterator> matches) |
Modifier and Type | Method and Description |
---|---|
private static BytesRefIterator |
asBytesRefIterator(java.util.List<Term> terms) |
int |
endOffset()
The ending offset of the current match, or
-1 if offsets are not available
Should only be called after MatchesIterator.next() has returned true |
int |
endPosition()
The end position of the current match
Should only be called after
MatchesIterator.next() has returned true |
(package private) static MatchesIterator |
fromSubIterators(java.util.List<MatchesIterator> mis) |
(package private) static MatchesIterator |
fromTerms(LeafReaderContext context,
int doc,
Query query,
java.lang.String field,
java.util.List<Term> terms)
Create a
DisjunctionMatchesIterator over a list of terms
Only terms that have at least one match in the given document will be included |
(package private) static MatchesIterator |
fromTermsEnum(LeafReaderContext context,
int doc,
Query query,
java.lang.String field,
BytesRefIterator terms)
Create a
DisjunctionMatchesIterator over a list of terms extracted from a BytesRefIterator
Only terms that have at least one match in the given document will be included |
Query |
getQuery()
Returns the Query causing the current match
If this
MatchesIterator has been returned from a MatchesIterator.getSubMatches()
call, then returns a TermQuery equivalent to the current match
Should only be called after MatchesIterator.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 MatchesIterator.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 MatchesIterator.next() has returned true |
int |
startPosition()
The start position of the current match
Should only be called after
MatchesIterator.next() has returned true |
private final PriorityQueue<MatchesIterator> queue
private boolean started
private DisjunctionMatchesIterator(java.util.List<MatchesIterator> matches) throws java.io.IOException
java.io.IOException
static MatchesIterator fromTerms(LeafReaderContext context, int doc, Query query, java.lang.String field, java.util.List<Term> terms) throws java.io.IOException
DisjunctionMatchesIterator
over a list of terms
Only terms that have at least one match in the given document will be includedjava.io.IOException
private static BytesRefIterator asBytesRefIterator(java.util.List<Term> terms)
static MatchesIterator fromTermsEnum(LeafReaderContext context, int doc, Query query, java.lang.String field, BytesRefIterator terms) throws java.io.IOException
DisjunctionMatchesIterator
over a list of terms extracted from a BytesRefIterator
Only terms that have at least one match in the given document will be includedjava.io.IOException
static MatchesIterator fromSubIterators(java.util.List<MatchesIterator> mis) throws java.io.IOException
java.io.IOException
public boolean next() throws java.io.IOException
MatchesIterator
next
in interface MatchesIterator
true
if matches have not been exhaustedjava.io.IOException
public int startPosition()
MatchesIterator
MatchesIterator.next()
has returned true
startPosition
in interface MatchesIterator
public int endPosition()
MatchesIterator
MatchesIterator.next()
has returned true
endPosition
in interface MatchesIterator
public int startOffset() throws java.io.IOException
MatchesIterator
-1
if offsets are not available
Should only be called after MatchesIterator.next()
has returned true
startOffset
in interface MatchesIterator
java.io.IOException
public int endOffset() throws java.io.IOException
MatchesIterator
-1
if offsets are not available
Should only be called after MatchesIterator.next()
has returned true
endOffset
in interface MatchesIterator
java.io.IOException
public MatchesIterator getSubMatches() throws java.io.IOException
MatchesIterator
null
if there are no submatches (ie the current iterator is at the
leaf level)
Should only be called after MatchesIterator.next()
has returned true
getSubMatches
in interface MatchesIterator
java.io.IOException
public Query getQuery()
MatchesIterator
MatchesIterator
has been returned from a MatchesIterator.getSubMatches()
call, then returns a TermQuery
equivalent to the current match
Should only be called after MatchesIterator.next()
has returned true
getQuery
in interface MatchesIterator