Class TopDocs
Represents hits returned by Search(Query, Filter?, int) and Search(Query, int).
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class TopDocs
Constructors
TopDocs(int, ScoreDoc[], float)
Represents hits returned by Search(Query, Filter?, int) and Search(Query, int).
Declaration
public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore)
Parameters
Type | Name | Description |
---|---|---|
int | totalHits | |
ScoreDoc[] | scoreDocs | |
float | maxScore |
Properties
MaxScore
Returns the maximum score value encountered. Note that in case scores are not tracked, this returns NaN.
Declaration
public virtual float MaxScore { get; set; }
Property Value
Type | Description |
---|---|
float |
ScoreDocs
The top hits for the query.
Declaration
public ScoreDoc[] ScoreDocs { get; set; }
Property Value
Type | Description |
---|---|
ScoreDoc[] |
TotalHits
The total number of hits for the query.
Declaration
public int TotalHits { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
Merge(Sort?, int, TopDocs[])
Returns a new TopDocs, containing topN
results across
the provided TopDocs, sorting by the specified
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
Create(Sort, int, bool, bool, bool, bool).
sort
=null to merge sort by score descending.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public static TopDocs Merge(Sort? sort, int topN, TopDocs[] shardHits)
Parameters
Type | Name | Description |
---|---|---|
Sort | sort | |
int | topN | |
TopDocs[] | shardHits |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Merge(Sort?, int, int, TopDocs[])
Same as 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 Count.
Declaration
public static TopDocs Merge(Sort? sort, int start, int size, TopDocs[] shardHits)
Parameters
Type | Name | Description |
---|---|---|
Sort | sort | |
int | start | |
int | size | |
TopDocs[] | shardHits |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|