java.lang.Object
org.apache.lucene.search.TopDocsCollector<FieldValueHitQueue.Entry>
org.apache.lucene.search.TopFieldCollector
- All Implemented Interfaces:
Collector
- Direct Known Subclasses:
TopFieldCollector.PagingFieldCollector
,TopFieldCollector.SimpleFieldCollector
A
Collector
that sorts by SortField
using FieldComparator
s.
See the constructor of TopFieldCollectorManager
for instantiating a
TopFieldCollectorManager with support for concurrency in IndexSearcher.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
(package private) static class
private class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) FieldValueHitQueue.Entry
(package private) final boolean
(package private) int
private static final ScoreDoc[]
(package private) final FieldComparator
<?> (package private) float
(package private) final MaxScoreAccumulator
(package private) final boolean
(package private) final int
(package private) final int
(package private) boolean
(package private) final ScoreMode
(package private) Boolean
(package private) final int
Fields inherited from class org.apache.lucene.search.TopDocsCollector
EMPTY_TOPDOCS, pq, totalHits, totalHitsRelation
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TopFieldCollector
(FieldValueHitQueue<FieldValueHitQueue.Entry> pq, int numHits, int totalHitsThreshold, boolean needsScores, MaxScoreAccumulator minScoreAcc) -
Method Summary
Modifier and TypeMethodDescription(package private) final void
add
(int slot, int doc) (package private) static boolean
canEarlyTerminate
(Sort searchSort, Sort indexSort) private static boolean
canEarlyTerminateOnDocId
(Sort searchSort) private static boolean
canEarlyTerminateOnPrefix
(Sort searchSort, Sort indexSort) boolean
Return whether collection terminated early.protected TopDocs
newTopDocs
(ScoreDoc[] results, int start) Returns aTopDocs
instance containing the given results.protected void
populateResults
(ScoreDoc[] results, int howMany) Populates the results array with the ScoreDoc instances.static void
populateScores
(ScoreDoc[] topDocs, IndexSearcher searcher, Query query) Populatescores
of the giventopDocs
.Indicates what features are required from the scorer.topDocs()
Returns the top docs that were collected by this collector.(package private) final void
updateBottom
(int doc) protected void
protected void
updateMinCompetitiveScore
(Scorable scorer) Methods inherited from class org.apache.lucene.search.TopDocsCollector
getTotalHits, topDocs, topDocs, topDocsSize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.search.Collector
getLeafCollector, setWeight
-
Field Details
-
EMPTY_SCOREDOCS
-
numHits
final int numHits -
totalHitsThreshold
final int totalHitsThreshold -
firstComparator
-
canSetMinScore
final boolean canSetMinScore -
searchSortPartOfIndexSort
Boolean searchSortPartOfIndexSort -
minScoreAcc
-
minCompetitiveScore
float minCompetitiveScore -
numComparators
final int numComparators -
bottom
FieldValueHitQueue.Entry bottom -
queueFull
boolean queueFull -
docBase
int docBase -
needsScores
final boolean needsScores -
scoreMode
-
-
Constructor Details
-
TopFieldCollector
private TopFieldCollector(FieldValueHitQueue<FieldValueHitQueue.Entry> pq, int numHits, int totalHitsThreshold, boolean needsScores, MaxScoreAccumulator minScoreAcc)
-
-
Method Details
-
canEarlyTerminate
-
canEarlyTerminateOnDocId
-
canEarlyTerminateOnPrefix
-
scoreMode
Description copied from interface:Collector
Indicates 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 Populatescores
of the giventopDocs
.- Parameters:
topDocs
- the top docs to populatesearcher
- the index searcher that has been used to computetopDocs
query
- the query that has been used to computetopDocs
- Throws:
IllegalArgumentException
- if there is evidence thattopDocs
have been computed against a different searcher or a different query.IOException
-
add
final void add(int slot, int doc) -
updateBottom
final void updateBottom(int doc) -
populateResults
Description copied from class:TopDocsCollector
Populates the results array with the ScoreDoc instances. This can be overridden in case a different ScoreDoc type should be returned.- Overrides:
populateResults
in classTopDocsCollector<FieldValueHitQueue.Entry>
-
newTopDocs
Description copied from class:TopDocsCollector
Returns aTopDocs
instance containing the given results. Ifresults
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.- Overrides:
newTopDocs
in classTopDocsCollector<FieldValueHitQueue.Entry>
-
topDocs
Description copied from class:TopDocsCollector
Returns the top docs that were collected by this collector.- Overrides:
topDocs
in classTopDocsCollector<FieldValueHitQueue.Entry>
-
isEarlyTerminated
public boolean isEarlyTerminated()Return whether collection terminated early.
-