Package org.apache.lucene.search
Class TopDocs
- java.lang.Object
 - 
- org.apache.lucene.search.TopDocs
 
 
- 
- Direct Known Subclasses:
 TopFieldDocs
public class TopDocs extends java.lang.ObjectRepresents hits returned byIndexSearcher.search(Query,Filter,int)andIndexSearcher.search(Query,int). 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetMaxScore()Returns the maximum score value encountered.static TopDocsmerge(Sort sort, int topN, TopDocs[] shardHits)Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by the specifiedSort.voidsetMaxScore(float maxScore)Sets the maximum score value encountered. 
 - 
 
- 
- 
Field Detail
- 
totalHits
public int totalHits
The total number of hits for the query. 
- 
scoreDocs
public ScoreDoc[] scoreDocs
The top hits for the query. 
 - 
 
- 
Constructor Detail
- 
TopDocs
public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore) 
 - 
 
- 
Method Detail
- 
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
public static TopDocs merge(Sort sort, int topN, TopDocs[] shardHits) throws java.io.IOException
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=truemust be passed toTopFieldCollector.create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean, boolean).Pass sort=null to merge sort by score descending.
- Throws:
 java.io.IOException
 
 - 
 
 -