
- Lucene Tutorial
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Indexing Operations
- Lucene - Search Operation
- Lucene - Query Programming
- Lucene - Analysis
- Lucene - Sorting
- Lucene Useful Resources
- Lucene - Quick Guide
- Lucene - Useful Resources
- Lucene - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Lucene - TopDocs
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 implements Serializable
Field
Following are the fields for org.apache.lucene.search.TopDocs class −
ScoreDoc[] scoreDocs − The top hits for the query.
int totalHits − The total number of hits for the query.
Class Constructors
The following table shows a class constructor −
S.No. | Constructor & Description |
---|---|
1 | TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore) |
Class Methods
The following table shows the different class methods −
S.No. | Method & Description |
---|---|
1 | getMaxScore() Returns the maximum score value encountered. |
2 | 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. |
3 | void setMaxScore(float maxScore) Sets the maximum score value encountered. |
Methods Inherited
This class inherits methods from the following classes −
- java.lang.Object