java.lang.Object | |||
↳ | org.apache.lucene.search.Collector | ||
↳ | org.apache.lucene.search.TopDocsCollector<T extends org.apache.lucene.search.ScoreDoc> | ||
↳ | org.apache.lucene.search.TopScoreDocCollector |
A Collector
implementation that collects the top-scoring hits,
returning them as a TopDocs
. This is used by IndexSearcher
to
implement TopDocs
-based search. Hits are sorted by score descending
and then (when the scores are tied) docID ascending. When you create an
instance of this collector you should know in advance whether documents are
going to be collected in doc Id order or not.
NOTE: The values NaN
and
{Float#NEGATIVE_INFINITY} are not valid scores. This
collector will not properly collect hits with such
scores.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.search.TopDocsCollector
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
TopScoreDocCollector given the number of hits to
collect and whether documents are scored in order by the input
Scorer to setScorer(Scorer) . | |||||||||||
Called before collecting from each IndexReader.
| |||||||||||
Called before successive calls to
collect(int) . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a
TopDocs instance containing the given results. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.search.TopDocsCollector
| |||||||||||
From class
org.apache.lucene.search.Collector
| |||||||||||
From class
java.lang.Object
|
Creates a new TopScoreDocCollector
given the number of hits to
collect and whether documents are scored in order by the input
Scorer
to setScorer(Scorer)
.
NOTE: The instances returned by this method
pre-allocate a full array of length
numHits
, and fill the array with sentinel
objects.
Called before collecting from each IndexReader. All doc ids in
collect(int)
will correspond to reader.
Add docBase to the current IndexReaders internal document id to re-base ids
in collect(int)
.
reader | next IndexReader |
---|
Called before successive calls to collect(int)
. Implementations
that need the score of the current document (passed-in to
collect(int)
), should save the passed-in Scorer and call
scorer.score() when needed.
IOException |
---|
Returns a TopDocs
instance containing the given results. If
results
is null it means there are no results to return,
either because there were 0 calls to collect() or because the arguments to
topDocs were invalid.