org.apache.lucene.search.suggest.document

## Class TopSuggestDocs

- java.lang.Object
- - org.apache.lucene.search.TopDocs
  - - org.apache.lucene.search.suggest.document.TopSuggestDocs

-     public class TopSuggestDocs
      extends TopDocs

  `TopDocs` wrapper with an additional CharSequence key per `ScoreDoc`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TopSuggestDocs.SuggestScoreDoc` `ScoreDoc` with an additional CharSequence key

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TopSuggestDocs` | `EMPTY` Singleton for empty `TopSuggestDocs`

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

      `scoreDocs, totalHits`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TopSuggestDocs(TotalHits totalHits, TopSuggestDocs.SuggestScoreDoc[] scoreDocs)` `TopDocs` wrapper with `TopSuggestDocs.SuggestScoreDoc` instead of `ScoreDoc`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TopSuggestDocs` | `merge(int topN, TopSuggestDocs[] shardHits)` Returns a new TopSuggestDocs, containing topN results across the provided TopSuggestDocs, sorting by score.
    `TopSuggestDocs.SuggestScoreDoc[]` | `scoreLookupDocs()` Returns `TopSuggestDocs.SuggestScoreDoc`s for this instance

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

      `merge, merge, merge, merge`

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

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

- - ### Field Detail

    - #### EMPTY

          public static final TopSuggestDocs EMPTY

      Singleton for empty `TopSuggestDocs`

  - ### Constructor Detail

    - #### TopSuggestDocs

          public TopSuggestDocs(TotalHits totalHits,
                                TopSuggestDocs.SuggestScoreDoc[] scoreDocs)

      `TopDocs` wrapper with `TopSuggestDocs.SuggestScoreDoc` instead of `ScoreDoc`

  - ### Method Detail

    - #### scoreLookupDocs

          public TopSuggestDocs.SuggestScoreDoc[] scoreLookupDocs()

      Returns `TopSuggestDocs.SuggestScoreDoc`s for this instance

    - #### merge

          public static TopSuggestDocs merge(int topN,
                                             TopSuggestDocs[] shardHits)

      Returns a new TopSuggestDocs, containing topN results across the provided TopSuggestDocs, sorting by score. Each `TopSuggestDocs` instance must be sorted. Analogous to `TopDocs.merge(int, org.apache.lucene.search.TopDocs[])` for `TopSuggestDocs` NOTE: assumes every `shardHit` is already sorted by score

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