| java.lang.Object org.apache.lucene.search.Scorer
All known Subclasses: org.apache.lucene.search.ConjunctionScorer, org.apache.lucene.search.spans.SpanScorer, org.apache.lucene.search.NonMatchingScorer, org.apache.lucene.search.DisjunctionSumScorer, org.apache.lucene.search.TermScorer, org.apache.lucene.search.PhraseScorer, org.apache.lucene.search.ReqExclScorer, org.apache.lucene.search.BooleanScorer2, org.apache.lucene.search.BooleanScorer, org.apache.lucene.search.ReqOptSumScorer, org.apache.lucene.search.DisjunctionMaxScorer,
Scorer | abstract public class Scorer (Code) | | Expert: Common scoring functionality for different types of queries.
A Scorer either iterates over documents matching a
query in increasing order of doc Id, or provides an explanation of
the score for a query for a given document.
Document scores are computed using a given Similarity
implementation.
See Also: BooleanQuery.setAllowDocsOutOfOrder |
Constructor Summary | |
protected | Scorer(Similarity similarity) Constructs a Scorer. |
Method Summary | |
abstract public int | doc() Returns the current document number matching the query. | abstract public Explanation | explain(int doc) Returns an explanation of the score for a document. | public Similarity | getSimilarity() Returns the Similarity implementation used by this scorer. | abstract public boolean | next() Advances to the document matching this Scorer with the lowest doc Id
greater than the current value of
Scorer.doc() (or to the matching
document with the lowest doc Id if next has never been called on
this Scorer). | public void | score(HitCollector hc) Scores and collects all matching documents. | protected boolean | score(HitCollector hc, int max) Expert: Collects matching documents in a range. | abstract public float | score() Returns the score of the current document matching the query. | abstract public boolean | skipTo(int target) Skips to the document matching this Scorer with the lowest doc Id
greater than or equal to a given target.
The behavior of this method is undefined if the target specified is
less than or equal to the current value of
Scorer.doc() .
Behaves as if written:
boolean skipTo(int target) {
do {
if (!next())
return false;
} while (target > doc());
return true;
}
Most implementations are considerably more efficient than that.
When this method is used the
Scorer.explain(int) method should not
be used.
Parameters: target - The target document number. |
Scorer | protected Scorer(Similarity similarity)(Code) | | Constructs a Scorer.
Parameters: similarity - The Similarity implementation used by this scorer. |
doc | abstract public int doc()(Code) | | Returns the current document number matching the query.
Initially invalid, until
Scorer.next() is called the first time.
|
getSimilarity | public Similarity getSimilarity()(Code) | | Returns the Similarity implementation used by this scorer.
|
next | abstract public boolean next() throws IOException(Code) | | Advances to the document matching this Scorer with the lowest doc Id
greater than the current value of
Scorer.doc() (or to the matching
document with the lowest doc Id if next has never been called on
this Scorer).
When this method is used the
Scorer.explain(int) method should not
be used.
true iff there is another document matching the query. See Also: BooleanQuery.setAllowDocsOutOfOrder |
score | protected boolean score(HitCollector hc, int max) throws IOException(Code) | | Expert: Collects matching documents in a range. Hook for optimization.
Note that
Scorer.next() must be called once before this method is called
for the first time.
Parameters: hc - The collector to which all matching documents are passed throughHitCollector.collect(intfloat). Parameters: max - Do not score documents past this. true if more matching documents may remain. |
skipTo | abstract public boolean skipTo(int target) throws IOException(Code) | | Skips to the document matching this Scorer with the lowest doc Id
greater than or equal to a given target.
The behavior of this method is undefined if the target specified is
less than or equal to the current value of
Scorer.doc() .
Behaves as if written:
boolean skipTo(int target) {
do {
if (!next())
return false;
} while (target > doc());
return true;
}
Most implementations are considerably more efficient than that.
When this method is used the
Scorer.explain(int) method should not
be used.
Parameters: target - The target document number. true iff there is such a match. See Also: BooleanQuery.setAllowDocsOutOfOrder |
|
|