Class TopDocs
- Direct Known Subclasses:
TopFieldDocs
IndexSearcher.search(Query,int)
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TopDocs
Same asmerge(int, TopDocs[])
but also ignores the topstart
top docs.static TopDocs
merge
(int start, int topN, TopDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Same as above, but accepts the passed in tie breakerstatic TopDocs
Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by score.static TopFieldDocs
merge
(Sort sort, int start, int topN, TopFieldDocs[] shardHits) Same asmerge(Sort, int, TopFieldDocs[])
but also ignores the topstart
top docs.static TopFieldDocs
merge
(Sort sort, int start, int topN, TopFieldDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Pass in a custom tie breaker for ordering resultsstatic TopFieldDocs
merge
(Sort sort, int topN, TopFieldDocs[] shardHits) Returns a new TopFieldDocs, containing topN results across the provided TopFieldDocs, sorting by the specifiedSort
.static TopDocs
Reciprocal Rank Fusion method.
-
Field Details
-
totalHits
The total number of hits for the query. -
scoreDocs
The top hits for the query.
-
-
Constructor Details
-
TopDocs
Constructs a TopDocs.
-
-
Method Details
-
merge
Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by score. EachTopDocs
instance must be sorted.- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
merge
Same asmerge(int, TopDocs[])
but also ignores the topstart
top docs. This is typically useful for pagination.docIDs are expected to be in consistent pattern i.e. either all ScoreDocs have their shardIndex set, or all have them as -1 (signifying that all hits belong to same searcher)
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
merge
public static TopDocs merge(int start, int topN, TopDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Same as above, but accepts the passed in tie breakerdocIDs are expected to be in consistent pattern i.e. either all ScoreDocs have their shardIndex set, or all have them as -1 (signifying that all hits belong to same searcher)
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
merge
Returns a new TopFieldDocs, containing topN results across the provided TopFieldDocs, sorting by the specifiedSort
. Each of the TopDocs must have been sorted by the same Sort, and sort field values must have been filled.- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
merge
Same asmerge(Sort, int, TopFieldDocs[])
but also ignores the topstart
top docs. This is typically useful for pagination.docIDs are expected to be in consistent pattern i.e. either all ScoreDocs have their shardIndex set, or all have them as -1 (signifying that all hits belong to same searcher)
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
merge
public static TopFieldDocs merge(Sort sort, int start, int topN, TopFieldDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Pass in a custom tie breaker for ordering results- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
rrf
Reciprocal Rank Fusion method.This method combines different search results into a single ranked list by combining their ranks. This is especially well suited when combining hits computed via different methods, whose score distributions are hardly comparable.
- Parameters:
topN
- the top N results to be returnedk
- a constant determines how much influence documents in individual rankings have on the final result. A higher value gives lower rank documents more influence. k should be greater than or equal to 1.hits
- a list of TopDocs to apply RRF on- Returns:
- a TopDocs contains the top N ranked results.
-