
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Search Operation
- Lucene - Sorting
Lucene - Indexing Operations
- Lucene - Indexing Operations
- Lucene - Add Document
- Lucene - Update Document
- Lucene - Delete Document
- Lucene - Field Options
Lucene - Query Programming
- Lucene - Query Programming
- Lucene - TermQuery
- Lucene - TermRangeQuery
- Lucene - PrefixQuery
- Lucene - BooleanQuery
- Lucene - PhraseQuery
- Lucene - WildCardQuery
- Lucene - FuzzyQuery
- Lucene - MatchAllDocsQuery
- Lucene - MatchNoDocsQuery
- Lucene - RegexpQuery
Lucene - Analysis
- Lucene - Analysis
- Lucene - WhitespaceAnalyzer
- Lucene - SimpleAnalyzer
- Lucene - StopAnalyzer
- Lucene - StandardAnalyzer
- Lucene - KeywordAnalyzer
- Lucene - CustomAnalyzer
- Lucene - EnglishAnalyzer
- Lucene - FrenchAnalyzer
- Lucene - SpanishAnalyzer
Lucene - Resources
Lucene - TopDocs Class
TopDocs points to the top N search results which matches the search criteria. It is simple container of pointers to point to documents which are output of search result.
Class Declaration
Following is the declaration for org.apache.lucene.search.TopDocs class −
public class TopDocs extends Object
Class Fields
Following table shows the fields for TopDocs −
S.No. | Field & Description |
---|---|
1 |
ScoreDoc[] scoreDocs The top hits for the query. |
1 |
TotalHits totalHits The total number of hits for the query. |
Class Constructors
Following table shows the constructors for TopDocs −
S.No. | Constructor & Description |
---|---|
1 |
TopDocs(TotalHits totalHits, ScoreDoc[] scoreDocs) Constructs a TopDocs. |
Class Methods
Following table shows the methods for TopDocs −
S.No. | Method & Description |
---|---|
1 |
static TopDocs merge(int start, int topN, TopDocs[] shardHits) Same as merge(int, TopDocs[]) but also ignores the top start top docs. |
2 |
static TopDocs merge(int start, int topN, TopDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Same as above, but accepts the passed in tie breaker. |
3 |
static TopDocs merge(int topN, TopDocs[] shardHits) Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by score. |
4 |
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. |
5 |
static TopFieldDocs merge(Sort sort, int start, int topN, TopFieldDocs[] shardHits, Comparator<ScoreDoc> tieBreaker) Pass in a custom tie breaker for ordering results. |
6 |
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. |
7 |
static TopDocs rrf(int topN, int k, TopDocs[] hits) Reciprocal Rank Fusion method. |
Methods Inherited
This class inherits methods from the following classes −
- java.lang.Object