public class TopDocs
extends java.lang.Object
IndexSearcher.search(Query,int)
.Modifier and Type | Class and Description |
---|---|
private static class |
TopDocs.MergeSortQueue |
private static class |
TopDocs.ScoreMergeSortQueue |
private static class |
TopDocs.ShardRef |
Modifier and Type | Field and Description |
---|---|
private float |
maxScore
Stores the maximum score value encountered, needed for normalizing.
|
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)
Constructs a TopDocs with a default maxScore=Float.NaN.
|
TopDocs(int totalHits,
ScoreDoc[] scoreDocs,
float maxScore) |
Modifier and Type | Method and Description |
---|---|
float |
getMaxScore()
Returns the maximum score value encountered.
|
static TopDocs |
merge(int start,
int topN,
TopDocs[] shardHits)
Same as
merge(int, TopDocs[]) but also ignores the top
start top docs. |
static TopDocs |
merge(int topN,
TopDocs[] shardHits)
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 as
merge(Sort, int, TopFieldDocs[]) but also ignores the top
start top docs. |
static TopFieldDocs |
merge(Sort sort,
int topN,
TopFieldDocs[] shardHits)
Returns a new TopFieldDocs, containing topN results across
the provided TopFieldDocs, sorting by the specified
Sort . |
private static TopDocs |
mergeAux(Sort sort,
int start,
int size,
TopDocs[] shardHits)
Auxiliary method used by the
merge(int, org.apache.lucene.search.TopDocs[]) impls. |
void |
setMaxScore(float maxScore)
Sets the maximum score value encountered.
|
public int totalHits
public ScoreDoc[] scoreDocs
private float maxScore
TopDocs(int totalHits, ScoreDoc[] scoreDocs)
public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore)
public float getMaxScore()
Float.NaN
.public void setMaxScore(float maxScore)
public static TopDocs merge(int topN, TopDocs[] shardHits) throws java.io.IOException
TopDocs
instance must be sorted.java.io.IOException
public static TopDocs merge(int start, int topN, TopDocs[] shardHits) throws java.io.IOException
merge(int, TopDocs[])
but also ignores the top
start
top docs. This is typically useful for pagination.java.io.IOException
public static TopFieldDocs merge(Sort sort, int topN, TopFieldDocs[] shardHits) throws java.io.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)
).java.io.IOException
public static TopFieldDocs merge(Sort sort, int start, int topN, TopFieldDocs[] shardHits) throws java.io.IOException
merge(Sort, int, TopFieldDocs[])
but also ignores the top
start
top docs. This is typically useful for pagination.java.io.IOException
private static TopDocs mergeAux(Sort sort, int start, int size, TopDocs[] shardHits) throws java.io.IOException
merge(int, org.apache.lucene.search.TopDocs[])
impls. A sort value of null
is used to indicate that docs should be sorted by score.java.io.IOException