Package org.apache.lucene.search
Class TopFieldCollector
java.lang.Object
org.apache.lucene.search.TopDocsCollector<FieldValueHitQueue.Entry>
org.apache.lucene.search.TopFieldCollector
- All Implemented Interfaces:
Collector
A
Collector that sorts by SortField using FieldComparators.
See the constructor of TopFieldCollectorManager for instantiating a
TopFieldCollectorManager with support for concurrency in IndexSearcher.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from class org.apache.lucene.search.TopDocsCollector
EMPTY_TOPDOCS, pq, totalHits, totalHitsRelation -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn whether collection terminated early.protected TopDocsnewTopDocs(ScoreDoc[] results, int start) Returns aTopDocsinstance containing the given results.protected voidpopulateResults(ScoreDoc[] results, int howMany) Populates the results array with the ScoreDoc instances.static voidpopulateScores(ScoreDoc[] topDocs, IndexSearcher searcher, Query query) Populatescoresof the giventopDocs.Indicates what features are required from the scorer.topDocs()Returns the top docs that were collected by this collector.protected voidprotected voidupdateMinCompetitiveScore(Scorable scorer) Methods inherited from class org.apache.lucene.search.TopDocsCollector
getTotalHits, 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
-
Method Details
-
scoreMode
Description copied from interface:CollectorIndicates what features are required from the scorer. -
updateGlobalMinCompetitiveScore
- Throws:
IOException
-
updateMinCompetitiveScore
- Throws:
IOException
-
populateScores
public static void populateScores(ScoreDoc[] topDocs, IndexSearcher searcher, Query query) throws IOException Populatescoresof the giventopDocs.- Parameters:
topDocs- the top docs to populatesearcher- the index searcher that has been used to computetopDocsquery- the query that has been used to computetopDocs- Throws:
IllegalArgumentException- if there is evidence thattopDocshave been computed against a different searcher or a different query.IOException- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
populateResults
Description copied from class:TopDocsCollectorPopulates the results array with the ScoreDoc instances. This can be overridden in case a different ScoreDoc type should be returned.- Overrides:
populateResultsin classTopDocsCollector<FieldValueHitQueue.Entry>
-
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<FieldValueHitQueue.Entry>
-
topDocs
Description copied from class:TopDocsCollectorReturns the top docs that were collected by this collector.- Overrides:
topDocsin classTopDocsCollector<FieldValueHitQueue.Entry>
-
isEarlyTerminated
public boolean isEarlyTerminated()Return whether collection terminated early.
-