org.apache.lucene.search.suggest.document

## Class SuggestIndexSearcher

- java.lang.Object
- - org.apache.lucene.search.IndexSearcher
  - - org.apache.lucene.search.suggest.document.SuggestIndexSearcher

-     public class SuggestIndexSearcher
      extends IndexSearcher

  Adds document suggest capabilities to IndexSearcher. Any `CompletionQuery` can be used to suggest documents. Use `PrefixCompletionQuery` for analyzed prefix queries, `RegexCompletionQuery` for regular expression prefix queries, `FuzzyCompletionQuery` for analyzed prefix with typo tolerance and `ContextQuery` to boost and/or filter suggestions by contexts
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.search.IndexSearcher

      `IndexSearcher.LeafSlice`

  - ### Field Summary

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

      `leafContexts, leafSlices, readerContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SuggestIndexSearcher(IndexReader reader)` Creates a searcher with document suggest capabilities for `reader`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TopSuggestDocs` | `suggest(CompletionQuery query, int n, boolean skipDuplicates)` Returns top `n` completion hits for `query`
    `void` | `suggest(CompletionQuery query, TopSuggestDocsCollector collector)` Lower-level suggest API.

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

      `collectionStatistics, count, createNormalizedWeight, createWeight, doc, doc, doc, explain, explain, getDefaultQueryCache, getDefaultQueryCachingPolicy, getDefaultSimilarity, getIndexReader, getQueryCache, getQueryCachingPolicy, getSimilarity, getTopReaderContext, rewrite, search, search, search, search, search, search, searchAfter, searchAfter, searchAfter, setDefaultQueryCache, setDefaultQueryCachingPolicy, setQueryCache, setQueryCachingPolicy, setSimilarity, slices, termStatistics, toString`

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

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

- - ### Constructor Detail

    - #### SuggestIndexSearcher

          public SuggestIndexSearcher(IndexReader reader)

      Creates a searcher with document suggest capabilities for `reader`.

  - ### Method Detail

    - #### suggest

          public TopSuggestDocs suggest(CompletionQuery query,
                                        int n,
                                        boolean skipDuplicates)
                                 throws IOException

      Returns top `n` completion hits for `query`
      Throws:
        `IOException`

    - #### suggest

          public void suggest(CompletionQuery query,
                              TopSuggestDocsCollector collector)
                       throws IOException

      Lower-level suggest API. Collects completion hits through `collector` for `query`.

      `TopSuggestDocsCollector.collect(int, CharSequence, CharSequence, float)` is called for every matching completion hit.

      Throws:
        `IOException`

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