Lucene - TopDocs


Advertisements


Introduction

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

S.N.Constructor & Description
1

TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore)

Class methods

S.N.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