Lucene - TopDocs


Advertisements


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

lucene_searching_classes.htm

Advertisements