final class ExactPhraseScorer extends Scorer
Modifier and Type | Class and Description |
---|---|
private static class |
ExactPhraseScorer.PostingsAndPosition |
Scorer.ChildScorer
Modifier and Type | Field and Description |
---|---|
private ConjunctionDISI |
conjunction |
private Similarity.SimScorer |
docScorer |
private int |
freq |
private float |
matchCost |
private boolean |
needsScores |
private ExactPhraseScorer.PostingsAndPosition[] |
postings |
Constructor and Description |
---|
ExactPhraseScorer(Weight weight,
PhraseQuery.PostingsAndFreq[] postings,
Similarity.SimScorer docScorer,
boolean needsScores,
float matchCost) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
advancePosition(ExactPhraseScorer.PostingsAndPosition posting,
int target)
Advance the given pos enum to the first doc on or after
target . |
int |
docID()
Returns the doc ID that is currently being scored.
|
int |
freq()
Returns the freq of this Scorer on the current document
|
DocIdSetIterator |
iterator()
Return a
DocIdSetIterator over matching documents. |
private int |
phraseFreq() |
float |
score()
Returns the score of the current document matching the query.
|
java.lang.String |
toString() |
TwoPhaseIterator |
twoPhaseIterator()
Optional method: Return a
TwoPhaseIterator view of this
Scorer . |
getChildren, getWeight
private final ConjunctionDISI conjunction
private final ExactPhraseScorer.PostingsAndPosition[] postings
private int freq
private final Similarity.SimScorer docScorer
private final boolean needsScores
private float matchCost
ExactPhraseScorer(Weight weight, PhraseQuery.PostingsAndFreq[] postings, Similarity.SimScorer docScorer, boolean needsScores, float matchCost) throws java.io.IOException
java.io.IOException
public TwoPhaseIterator twoPhaseIterator()
Scorer
TwoPhaseIterator
view of this
Scorer
. A return value of null
indicates that
two-phase iteration is not supported.
Note that the returned TwoPhaseIterator
's
approximation
must
advance synchronously with the Scorer.iterator()
: advancing the
approximation must advance the iterator and vice-versa.
Implementing this method is typically useful on Scorer
s
that have a high per-document overhead in order to confirm matches.
The default implementation returns null
.twoPhaseIterator
in class Scorer
public DocIdSetIterator iterator()
Scorer
DocIdSetIterator
over matching documents.
The returned iterator will either be positioned on -1
if no
documents have been scored yet, DocIdSetIterator.NO_MORE_DOCS
if all documents have been scored already, or the last document id that
has been scored otherwise.
The returned iterator is a view: calling this method several times will
return iterators that have the same state.public java.lang.String toString()
toString
in class java.lang.Object
public int freq()
Scorer
public int docID()
Scorer
-1
if the Scorer.iterator()
is not positioned
or DocIdSetIterator.NO_MORE_DOCS
if it has been entirely consumed.docID
in class Scorer
DocIdSetIterator.docID()
public float score()
Scorer
DocIdSetIterator.nextDoc()
or
DocIdSetIterator.advance(int)
is called on the Scorer.iterator()
the first time, or when called from within LeafCollector.collect(int)
.private static boolean advancePosition(ExactPhraseScorer.PostingsAndPosition posting, int target) throws java.io.IOException
target
.
Return false
if the enum was exhausted before reaching
target
and true
otherwise.java.io.IOException
private int phraseFreq() throws java.io.IOException
java.io.IOException