TopSuggestDocs (Lucene 10.5.1 suggest API)
Description: declaration: package: org.apache.lucene.search.suggest.document, class: TopSuggestDocs

Package 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
  Description
  `static class`
  `TopSuggestDocs.SuggestScoreDoc`
  `ScoreDoc` with an additional CharSequence key

- ## Field Summary

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

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

  `scoreDocs, totalHits`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  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, merge, merge, rrf`

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

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

- ## Field Details

  - ### EMPTY

    public static final TopSuggestDocs EMPTY
    Singleton for empty `TopSuggestDocs`

- ## Constructor Details

  - ### TopSuggestDocs

    public TopSuggestDocs(TotalHits totalHits, TopSuggestDocs.SuggestScoreDoc[] scoreDocs)
    `TopDocs` wrapper with `TopSuggestDocs.SuggestScoreDoc` instead of `ScoreDoc`

- ## Method Details

  - ### 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