public class TopDocs extends Object
IndexSearcher.search(Query,Filter,int)
and IndexSearcher.search(Query,int)
.Modifier and Type | Field and Description |
---|---|
ScoreDoc[] |
scoreDocs
The top hits for the query.
|
int |
totalHits
The total number of hits for the query.
|
Constructor and Description |
---|
TopDocs(int totalHits,
ScoreDoc[] scoreDocs,
float maxScore) |
Modifier and Type | Method and Description |
---|---|
float |
getMaxScore()
Returns the maximum score value encountered.
|
static TopDocs |
merge(Sort sort,
int start,
int size,
TopDocs[] shardHits)
Same as
merge(Sort, int, TopDocs[]) but also slices the result at the same time based
on the provided start and size. |
static TopDocs |
merge(Sort sort,
int topN,
TopDocs[] shardHits)
Returns a new TopDocs, containing topN results across
the provided TopDocs, sorting by the specified
Sort . |
void |
setMaxScore(float maxScore)
Sets the maximum score value encountered.
|
public int totalHits
public ScoreDoc[] scoreDocs
public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore)
public float getMaxScore()
Float.NaN
.public void setMaxScore(float maxScore)
public static TopDocs merge(Sort sort, int topN, TopDocs[] shardHits) throws IOException
Sort
. 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 to TopFieldCollector.create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean, boolean)
.
Pass sort=null to merge sort by score descending.
IOException
public static TopDocs merge(Sort sort, int start, int size, TopDocs[] shardHits) throws IOException
merge(Sort, int, TopDocs[])
but also slices the result at the same time based
on the provided start and size. The return TopDocs will always have a scoreDocs with length of at most size.IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.