## org.apache.lucene.search
Class TopDocs

    java.lang.Object
      org.apache.lucene.search.TopDocs

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  TopFieldDocs

    public class TopDocs

extends java.lang.Object
implements java.io.Serializable

Represents hits returned by `Searcher.search(Query,Filter,int)` and `Searcher.search(Query,int)`.

See Also:
  Serialized Form

Field Summary
`ScoreDoc[]` `scoreDocs` The top hits for the query.
`int` `totalHits` The total number of hits for the query.

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

Method Summary
`float` `getMaxScore()` Returns the maximum score value encountered.
`void` `setMaxScore(float maxScore)` Sets the maximum score value encountered.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### totalHits

    public int totalHits

  The total number of hits for the query.

### scoreDocs

    public ScoreDoc[] scoreDocs

  The top hits for the query.

Constructor Detail

### TopDocs

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

Method Detail

### getMaxScore

    public float getMaxScore()

  Returns the maximum score value encountered. Note that in case scores are not tracked, this returns `Float.NaN`.

### setMaxScore

    public void setMaxScore(float maxScore)

  Sets the maximum score value encountered.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.