Package org.apache.lucene.search
Class TopDocs
java.lang.Object
org.apache.lucene.search.TopDocs
- Direct Known Subclasses:
TopFieldDocs
Represents hits returned by
IndexSearcher.search(Query,Filter,int)
and IndexSearcher.search(Query,int)
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the maximum score value encountered.static TopDocs
Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by the specifiedSort
.void
setMaxScore
(float maxScore) Sets the maximum score value encountered.
-
Field Details
-
totalHits
public int totalHitsThe total number of hits for the query. -
scoreDocs
The top hits for the query.
-
-
Constructor Details
-
TopDocs
-
-
Method Details
-
getMaxScore
public float getMaxScore()Returns the maximum score value encountered. Note that in case scores are not tracked, this returnsFloat.NaN
. -
setMaxScore
public void setMaxScore(float maxScore) Sets the maximum score value encountered. -
merge
Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by the specifiedSort
. Each of the TopDocs must have been sorted by the same Sort, and sort field values must have been filled (ie,fillFields=true
must be passed toTopFieldCollector.create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean, boolean)
.Pass sort=null to merge sort by score descending.
- Throws:
IOException
-