- All Implemented Interfaces:
Collector
- Direct Known Subclasses:
TopScoreDocCollector.PagingTopScoreDocCollector,TopScoreDocCollector.SimpleTopScoreDocCollector
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classstatic classScorable leaf collector(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) final HitsThresholdChecker(package private) float(package private) final MaxScoreAccumulator(package private) ScoreDocFields inherited from class org.apache.lucene.search.TopDocsCollector
EMPTY_TOPDOCS, pq, totalHits, totalHitsRelation -
Constructor Summary
ConstructorsConstructorDescriptionTopScoreDocCollector(int numHits, HitsThresholdChecker hitsThresholdChecker, MaxScoreAccumulator minScoreAcc) -
Method Summary
Modifier and TypeMethodDescriptionstatic TopScoreDocCollectorcreate(int numHits, int totalHitsThreshold) Deprecated.static TopScoreDocCollectorDeprecated.This method is deprecated in favor of the constructor ofTopScoreDocCollectorManagerdue to its support for concurrency in IndexSearchercreateSharedManager(int numHits, ScoreDoc after, int totalHitsThreshold) Deprecated.This method is deprecated in favor of the constructor ofTopScoreDocCollectorManagerdue to its support for concurrency in IndexSearcherprotected TopDocsnewTopDocs(ScoreDoc[] results, int start) Returns aTopDocsinstance containing the given results.Indicates what features are required from the scorer.protected voidprotected voidupdateMinCompetitiveScore(Scorable scorer) Methods inherited from class org.apache.lucene.search.TopDocsCollector
getTotalHits, populateResults, topDocs, topDocs, topDocs, topDocsSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.search.Collector
getLeafCollector, setWeight
-
Field Details
-
docBase
int docBase -
pqTop
ScoreDoc pqTop -
hitsThresholdChecker
-
minScoreAcc
-
minCompetitiveScore
float minCompetitiveScore
-
-
Constructor Details
-
TopScoreDocCollector
TopScoreDocCollector(int numHits, HitsThresholdChecker hitsThresholdChecker, MaxScoreAccumulator minScoreAcc)
-
-
Method Details
-
create
Deprecated.This method is deprecated in favor of the constructor ofTopScoreDocCollectorManagerdue to its support for concurrency in IndexSearcherCreates a newTopScoreDocCollectorgiven 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
totalHitsThresholdthen this value is accurate. On the other hand, if theTopDocs.totalHitsvalue is greater thantotalHitsThresholdthen its value is a lower bound of the hit count. A value ofInteger.MAX_VALUEwill 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. -
create
@Deprecated public static TopScoreDocCollector create(int numHits, ScoreDoc after, int totalHitsThreshold) Deprecated.This method is deprecated in favor of the constructor ofTopScoreDocCollectorManagerdue to its support for concurrency in IndexSearcherCreates a newTopScoreDocCollectorgiven 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
totalHitsThresholdthen this value is accurate. On the other hand, if theTopDocs.totalHitsvalue is greater thantotalHitsThresholdthen its value is a lower bound of the hit count. A value ofInteger.MAX_VALUEwill 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. -
newTopDocs
Description copied from class:TopDocsCollectorReturns aTopDocsinstance containing the given results. Ifresultsis 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.- Overrides:
newTopDocsin classTopDocsCollector<ScoreDoc>
-
scoreMode
Description copied from interface:CollectorIndicates what features are required from the scorer. -
updateGlobalMinCompetitiveScore
- Throws:
IOException
-
updateMinCompetitiveScore
- Throws:
IOException
-
TopScoreDocCollectorManagerdue to its support for concurrency in IndexSearcher