public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc>
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 Float.NaN and
Float.NEGATIVE_INFINITY are not valid scores. This
collector will not properly collect hits with such
scores.
EMPTY_TOPDOCS, pq, totalHits, totalHitsRelation| Modifier and Type | Method and Description |
|---|---|
static TopScoreDocCollector |
create(int numHits,
int totalHitsThreshold)
Creates a new
TopScoreDocCollector given the number of hits to
collect and the number of hits to count accurately. |
static TopScoreDocCollector |
create(int numHits,
ScoreDoc after,
int totalHitsThreshold)
Creates a new
TopScoreDocCollector given the number of hits to
collect, the bottom of the previous page, and the number of hits to count
accurately. |
static CollectorManager<TopScoreDocCollector,TopDocs> |
createSharedManager(int numHits,
FieldDoc after,
int totalHitsThreshold)
Create a CollectorManager which uses a shared hit counter to maintain number of hits
and a shared
MaxScoreAccumulator to propagate the minimum score accross segments |
protected TopDocs |
newTopDocs(ScoreDoc[] results,
int start)
Returns a
TopDocs instance containing the given results. |
ScoreMode |
scoreMode()
Indicates what features are required from the scorer.
|
protected void |
updateGlobalMinCompetitiveScore(Scorable scorer) |
protected void |
updateMinCompetitiveScore(Scorable scorer) |
getTotalHits, populateResults, topDocs, topDocs, topDocs, topDocsSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLeafCollectorpublic static TopScoreDocCollector create(int numHits, int totalHitsThreshold)
TopScoreDocCollector given the number of hits to
collect and the number of hits to count accurately.
NOTE: If the total hit count of the top docs is less than or exactly
totalHitsThreshold then this value is accurate. On the other hand,
if the TopDocs.totalHits value is greater than totalHitsThreshold
then its value is a lower bound of the hit count. A value of Integer.MAX_VALUE
will make the hit count accurate but will also likely make query processing slower.
NOTE: The instances returned by this method
pre-allocate a full array of length
numHits, and fill the array with sentinel
objects.
public static TopScoreDocCollector create(int numHits, ScoreDoc after, int totalHitsThreshold)
TopScoreDocCollector given the number of hits to
collect, the bottom of the previous page, and the number of hits to count
accurately.
NOTE: If the total hit count of the top docs is less than or exactly
totalHitsThreshold then this value is accurate. On the other hand,
if the TopDocs.totalHits value is greater than totalHitsThreshold
then its value is a lower bound of the hit count. A value of Integer.MAX_VALUE
will make the hit count accurate but will also likely make query processing slower.
NOTE: The instances returned by this method
pre-allocate a full array of length
numHits, and fill the array with sentinel
objects.
public static CollectorManager<TopScoreDocCollector,TopDocs> createSharedManager(int numHits, FieldDoc after, int totalHitsThreshold)
MaxScoreAccumulator to propagate the minimum score accross segmentsprotected TopDocs newTopDocs(ScoreDoc[] results, int start)
TopDocsCollectorTopDocs 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.newTopDocs in class TopDocsCollector<ScoreDoc>public ScoreMode scoreMode()
Collectorprotected void updateGlobalMinCompetitiveScore(Scorable scorer) throws IOException
IOExceptionprotected void updateMinCompetitiveScore(Scorable scorer) throws IOException
IOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.