org.apache.lucene.search

## Class TopFieldDocs

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

-     public class TopFieldDocs
      extends TopDocs

  Represents hits returned by `IndexSearcher.search(Query,int,Sort)`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `SortField[]` | `fields` The fields which were used to sort results by.

    - ### Fields inherited from class org.apache.lucene.search.TopDocs

      `scoreDocs, totalHits`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TopFieldDocs(int totalHits, ScoreDoc[] scoreDocs, SortField[] fields, float maxScore)` Creates one of these objects.

  - ### Method Summary

    - ### Methods inherited from class org.apache.lucene.search.TopDocs

      `getMaxScore, merge, merge, merge, merge, setMaxScore`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### fields

          public SortField[] fields

      The fields which were used to sort results by.

  - ### Constructor Detail

    - #### TopFieldDocs

          public TopFieldDocs(int totalHits,
                              ScoreDoc[] scoreDocs,
                              SortField[] fields,
                              float maxScore)

      Creates one of these objects.
      Parameters:
        `totalHits` - Total number of hits for the query.
        `scoreDocs` - The top hits for the query.
        `fields` - The sort criteria used to find the top hits.
        `maxScore` - The maximum score encountered.

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