org.apache.solr.spelling.suggest

## Class SolrSuggester

- java.lang.Object
- - org.apache.solr.spelling.suggest.SolrSuggester

- All Implemented Interfaces:
    Accountable

      public class SolrSuggester
      extends Object
      implements Accountable

  Responsible for loading the lookup and dictionary Implementations specified by the SolrConfig. Interacts (query/build/reload) with Lucene Suggesters through `Lookup` and `Dictionary`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_DICT_NAME` Name used when an unnamed suggester config is passed
    `static String` | `DICTIONARY_IMPL` Fully-qualified class of the `Dictionary` implementation
    `static String` | `LOCATION` Location of the source data - either a path to a file, or null for the current IndexReader.
    `static String` | `LOOKUP_IMPL` Fully-qualified class of the `Lookup` implementation.
    `static String` | `STORE_DIR` Name of the location where to persist the dictionary.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrSuggester()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `build(SolrCore core, SolrIndexSearcher searcher)` Build the underlying Lucene Suggester
    `Collection<Accountable>` | `getChildResources()`
    `String` | `getName()` Returns the unique name of the suggester
    `File` | `getStoreFile()`
    `SuggesterResult` | `getSuggestions(SuggesterOptions options)` Returns suggestions based on the `SuggesterOptions` passed
    `String` | `init(NamedList<?> config, SolrCore core)` Uses the `config` and the `core` to initialize the underlying Lucene suggester
    `long` | `ramBytesUsed()`
    `void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the underlying Lucene Suggester
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### DEFAULT_DICT_NAME

          public static final String DEFAULT_DICT_NAME

      Name used when an unnamed suggester config is passed
      See Also:
        Constant Field Values

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

    - #### DICTIONARY_IMPL

          public static final String DICTIONARY_IMPL

      Fully-qualified class of the `Dictionary` implementation
      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

  - ### Constructor Detail

    - #### SolrSuggester

          public SolrSuggester()

  - ### Method Detail

    - #### init

          public String init(NamedList<?> config,
                             SolrCore core)

      Uses the `config` and the `core` to initialize the underlying Lucene suggester

    - #### build

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

      Build the underlying Lucene Suggester
      Throws:
        `IOException`

    - #### reload

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

      Reloads the underlying Lucene Suggester
      Throws:
        `IOException`

    - #### getStoreFile

          public File getStoreFile()

      Returns:
        the file where this suggester is stored. null if no storeDir was configured

    - #### getSuggestions

          public SuggesterResult getSuggestions(SuggesterOptions options)
                                         throws IOException

      Returns suggestions based on the `SuggesterOptions` passed
      Throws:
        `IOException`

    - #### getName

          public String getName()

      Returns the unique name of the suggester

    - #### ramBytesUsed

          public long ramBytesUsed()

      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### getChildResources

          public Collection<Accountable> getChildResources()

      Specified by:
        `getChildResources` in interface `Accountable`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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