public abstract class TwoPhaseIterator extends Object
Scorer.asTwoPhaseIterator()
and Spans.asTwoPhaseIterator()
to expose an approximation of a DocIdSetIterator
.
When the approximation()
's
DocIdSetIterator.nextDoc()
or DocIdSetIterator.advance(int)
return, matches()
needs to be checked in order to know whether the
returned doc ID actually matches.Modifier and Type | Field and Description |
---|---|
protected DocIdSetIterator |
approximation |
Modifier | Constructor and Description |
---|---|
protected |
TwoPhaseIterator(DocIdSetIterator approximation)
Takes the approximation to be returned by
approximation . |
Modifier and Type | Method and Description |
---|---|
DocIdSetIterator |
approximation()
Return an approximation.
|
static DocIdSetIterator |
asDocIdSetIterator(TwoPhaseIterator twoPhaseIterator)
Return a
DocIdSetIterator view of the provided
TwoPhaseIterator . |
static TwoPhaseIterator |
asTwoPhaseIterator(DocIdSetIterator iter)
Returns a
TwoPhaseIterator for this DocIdSetIterator
when available * otherwise returns null. |
abstract boolean |
matches()
Return whether the current doc ID that the iterator is on matches.
|
protected final DocIdSetIterator approximation
protected TwoPhaseIterator(DocIdSetIterator approximation)
approximation
. Not null.public static DocIdSetIterator asDocIdSetIterator(TwoPhaseIterator twoPhaseIterator)
DocIdSetIterator
view of the provided
TwoPhaseIterator
.public DocIdSetIterator approximation()
DocIdSetIterator
is a
superset of the matching documents, and each match needs to be confirmed
with matches()
in order to know whether it matches or not.public abstract boolean matches() throws IOException
DocIdSetIterator.docID()
is -1
or
DocIdSetIterator.NO_MORE_DOCS
-- and at most once.IOException
public static TwoPhaseIterator asTwoPhaseIterator(DocIdSetIterator iter)
TwoPhaseIterator
for this DocIdSetIterator
when available * otherwise returns null.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.