org.apache.lucene.search
Class Scorer
java.lang.Object
org.apache.lucene.search.Scorer
public abstract class Scorer
extends java.lang.Object
Expert: Implements scoring for a class of queries.
int | doc() - Returns the current document number.
|
Explanation | explain(int doc) - Returns an explanation of the score for
doc .
|
Similarity | getSimilarity() - Returns the Similarity implementation used by this scorer.
|
boolean | next() - Advance to the next document matching the query.
|
float | score() - Returns the score of the current document.
|
void | score(HitCollector hc) - Scores all documents and passes them to a collector.
|
boolean | skipTo(int target) - Skips to the first match beyond the current whose document number is
greater than or equal to target.
|
Scorer
protected Scorer(Similarity similarity)
Constructs a Scorer.
doc
public int doc()
Returns the current document number. Initially invalid, until
next()
is called the first time.
explain
public Explanation explain(int doc)
throws IOException
Returns an explanation of the score for doc
.
getSimilarity
public Similarity getSimilarity()
Returns the Similarity implementation used by this scorer.
next
public boolean next()
throws IOException
Advance to the next document matching the query. Returns true iff there
is another match.
score
public float score()
throws IOException
Returns the score of the current document. Initially invalid, until
next()
is called the first time.
score
public void score(HitCollector hc)
throws IOException
Scores all documents and passes them to a collector.
skipTo
public boolean skipTo(int target)
throws IOException
Skips to the first match beyond the current whose document number is
greater than or equal to
target.
Returns true iff there is such
a match.
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.
Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.