org.apache.solr.spelling

## Class SolrSpellChecker

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

- Direct Known Subclasses:
    AbstractLuceneSpellChecker, ConjunctionSolrSpellChecker, DirectSolrSpellChecker, Suggester, WordBreakSolrSpellChecker

      public abstract class SolrSpellChecker
      extends Object

  Refer to SpellCheckComponent for more details.

  Since:
    solr 1.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Analyzer` | `analyzer`
    `static String` | `DEFAULT_DICTIONARY_NAME`
    `static String` | `DICTIONARY_NAME`
    `protected String` | `field`
    `static String` | `FIELD`
    `static String` | `FIELD_TYPE`
    `protected String` | `fieldTypeName`
    `protected String` | `name` Dictionary name

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrSpellChecker()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `build(SolrCore core, SolrIndexSearcher searcher)` (re)Builds the spelling index.
    `protected float` | `getAccuracy()` Get the value of `SpellingParams.SPELLCHECK_ACCURACY` if supported.
    `String` | `getDictionaryName()`
    `Analyzer` | `getQueryAnalyzer()`
    `protected StringDistance` | `getStringDistance()` Get the distance implementation used by this spellchecker, or NULL if not applicable.
    `abstract SpellingResult` | `getSuggestions(SpellingOptions options)` Get suggestions for the given query.
    `String` | `init(NamedList config, SolrCore core)`
    `boolean` | `isSuggestionsMayOverlap()`
    `SpellingResult` | `mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults)` Integrate spelling suggestions from the various shards in a distributed environment.
    `abstract void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the index.

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

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

- - ### Field Detail

    - #### DICTIONARY_NAME

          public static final String DICTIONARY_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_DICTIONARY_NAME

          public static final String DEFAULT_DICTIONARY_NAME

      See Also:
        Constant Field Values

    - #### FIELD

          public static final String FIELD

      See Also:
        Constant Field Values

    - #### FIELD_TYPE

          public static final String FIELD_TYPE

      See Also:
        Constant Field Values

    - #### name

          protected String name

      Dictionary name

    - #### analyzer

          protected Analyzer analyzer

    - #### field

          protected String field

    - #### fieldTypeName

          protected String fieldTypeName

  - ### Constructor Detail

    - #### SolrSpellChecker

          public SolrSpellChecker()

  - ### Method Detail

    - #### init

          public String init(NamedList config,
                             SolrCore core)

    - #### mergeSuggestions

          public SpellingResult mergeSuggestions(SpellCheckMergeData mergeData,
                                                 int numSug,
                                                 int count,
                                                 boolean extendedResults)

      Integrate spelling suggestions from the various shards in a distributed environment.

    - #### getQueryAnalyzer

          public Analyzer getQueryAnalyzer()

    - #### getDictionaryName

          public String getDictionaryName()

    - #### reload

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

      Reloads the index. Useful if an external process is responsible for building the spell checker.
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### build

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

      (re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.
      Throws:
        `IOException`

    - #### getAccuracy

          protected float getAccuracy()

      Get the value of `SpellingParams.SPELLCHECK_ACCURACY` if supported. Otherwise throws UnsupportedOperationException.

    - #### getStringDistance

          protected StringDistance getStringDistance()

      Get the distance implementation used by this spellchecker, or NULL if not applicable.

    - #### getSuggestions

          public abstract SpellingResult getSuggestions(SpellingOptions options)
                                                 throws IOException

      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.
      Parameters:
        `options` - The `SpellingOptions` to use
      Returns:
        The `SpellingResult` suggestions
      Throws:
        `IOException` - if there is an error producing suggestions

    - #### isSuggestionsMayOverlap

          public boolean isSuggestionsMayOverlap()

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