org.apache.solr.spelling.suggest

## Class Suggester

- java.lang.Object
- - org.apache.solr.spelling.SolrSpellChecker
  - - org.apache.solr.spelling.suggest.Suggester

-     public class Suggester
      extends SolrSpellChecker

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SolrCore` | `core`
    `protected Dictionary` | `dictionary`
    `static String` | `LOCATION` Location of the source data - either a path to a file, or null for the current IndexReader.
    `protected Lookup` | `lookup`
    `static String` | `LOOKUP_IMPL` Fully-qualified class of the `Lookup` implementation.
    `protected String` | `lookupImpl`
    `protected IndexReader` | `reader`
    `protected String` | `sourceLocation`
    `static String` | `STORE_DIR` Name of the location where to persist the dictionary.
    `protected File` | `storeDir`
    `protected float` | `threshold`
    `static String` | `THRESHOLD_TOKEN_FREQUENCY` Minimum frequency of terms to consider when building the dictionary.

    - ### Fields inherited from class org.apache.solr.spelling.SolrSpellChecker

      `analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Suggester()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `build(SolrCore core, SolrIndexSearcher searcher)` (re)Builds the spelling index.
    `SpellingResult` | `getSuggestions(SpellingOptions options)` Get suggestions for the given query.
    `String` | `init(NamedList config, SolrCore core)`
    `void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the index.

    - ### Methods inherited from class org.apache.solr.spelling.SolrSpellChecker

      `getAccuracy, getDictionaryName, getQueryAnalyzer, getStringDistance, isSuggestionsMayOverlap, mergeSuggestions`

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

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

- - ### Field Detail

    - #### LOCATION

          public static final String LOCATION

      Location of the source data - either a path to a file, or null for the current IndexReader.
      See Also:
        Constant Field Values

    - #### LOOKUP_IMPL

          public static final String LOOKUP_IMPL

      Fully-qualified class of the `Lookup` implementation.
      See Also:
        Constant Field Values

    - #### THRESHOLD_TOKEN_FREQUENCY

          public static final String THRESHOLD_TOKEN_FREQUENCY

      Minimum frequency of terms to consider when building the dictionary.
      See Also:
        Constant Field Values

    - #### STORE_DIR

          public static final String STORE_DIR

      Name of the location where to persist the dictionary. If this location is relative then the data will be stored under the core's dataDir. If this is null the storing will be disabled.
      See Also:
        Constant Field Values

    - #### sourceLocation

          protected String sourceLocation

    - #### storeDir

          protected File storeDir

    - #### threshold

          protected float threshold

    - #### dictionary

          protected Dictionary dictionary

    - #### reader

          protected IndexReader reader

    - #### lookup

          protected Lookup lookup

    - #### lookupImpl

          protected String lookupImpl

    - #### core

          protected SolrCore core

  - ### Constructor Detail

    - #### Suggester

          public Suggester()

  - ### Method Detail

    - #### init

          public String init(NamedList config,
                             SolrCore core)

      Overrides:
        `init` in class `SolrSpellChecker`

    - #### build

          public void build(SolrCore core,
                            SolrIndexSearcher searcher)
                     throws IOException

      Description copied from class: `SolrSpellChecker`
      (re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.
      Specified by:
        `build` in class `SolrSpellChecker`
      Throws:
        `IOException`

    - #### reload

          public void reload(SolrCore core,
                             SolrIndexSearcher searcher)
                      throws IOException

      Description copied from class: `SolrSpellChecker`
      Reloads the index. Useful if an external process is responsible for building the spell checker.
      Specified by:
        `reload` in class `SolrSpellChecker`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### getSuggestions

          public SpellingResult getSuggestions(SpellingOptions options)
                                        throws IOException

      Description copied from class: `SolrSpellChecker`
      Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The `SpellingResult.getSuggestions()` suggestions must be ordered by best suggestion first.
      Specified by:
        `getSuggestions` in class `SolrSpellChecker`
      Parameters:
        `options` - The `SpellingOptions` to use
      Returns:
        The `SpellingResult` suggestions
      Throws:
        `IOException` - if there is an error producing suggestions

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