Module org.apache.lucene.sandbox
Package org.apache.lucene.sandbox.search
Class LargeNumHitsTopDocsCollector
java.lang.Object
org.apache.lucene.sandbox.search.LargeNumHitsTopDocsCollector
- All Implemented Interfaces:
Collector
Optimized collector for large number of hits. The collector maintains an ArrayList of hits until
it accumulates the requested number of hits. Post that, it builds a Priority Queue and starts
filtering further hits based on the minimum competitive score.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLeafCollector(LeafReaderContext context) Create a newcollectorto collect the given context.protected TopDocsnewTopDocs(ScoreDoc[] results) Returns aTopDocsinstance containing the given results.protected voidpopulateResults(ScoreDoc[] results, int howMany) Populates the results array with the ScoreDoc instances.Indicates what features are required from the scorer.topDocs()Returns the top docs that were collected by this collector.topDocs(int howMany) Returns the top docs that were collected by this collector.
-
Field Details
-
Constructor Details
-
LargeNumHitsTopDocsCollector
public LargeNumHitsTopDocsCollector(int requestedHitCount)
-
-
Method Details
-
scoreMode
Description copied from interface:CollectorIndicates what features are required from the scorer. -
getLeafCollector
Description copied from interface:CollectorCreate a newcollectorto collect the given context.- Specified by:
getLeafCollectorin interfaceCollector- Parameters:
context- next atomic reader context
-
topDocs
Returns the top docs that were collected by this collector. -
populateResults
Populates the results array with the ScoreDoc instances. This can be overridden in case a different ScoreDoc type should be returned. -
newTopDocs
Returns 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. -
topDocs
Returns the top docs that were collected by this collector.
-