public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc>
Collectorimplementation that collects the top-scoring hits, returning them as a
TopDocs. This is used by
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.
|Modifier and Type||Method and Description|
Called before collecting from each
Called before successive calls to
getTotalHits, populateResults, topDocs, topDocs, topDocs, topDocsSize
public static TopScoreDocCollector create(int numHits, boolean docsScoredInOrder)
public static TopScoreDocCollector create(int numHits, ScoreDoc after, boolean docsScoredInOrder)
TopScoreDocCollectorgiven the number of hits to collect, the bottom of the previous page, and whether documents are scored in order by the input
NOTE: The instances returned by this method
pre-allocate a full array of length
numHits, and fill the array with sentinel
TopDocsinstance containing the given results. If
resultsis 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.
public void setNextReader(AtomicReaderContext context)
AtomicReaderContext. All doc ids in
Collector.collect(int)will correspond to
AtomicReaderContext.docBaseto the current
IndexReaderContext.reader()'s internal document id to re-base ids in
public void setScorer(Scorer scorer) throws IOException
Collector.collect(int). Implementations that need the score of the current document (passed-in to
Collector.collect(int)), should save the passed-in Scorer and call scorer.score() when needed.
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.