org.apache.solr.spelling

## Class WordBreakSolrSpellChecker

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

-     public class WordBreakSolrSpellChecker
      extends SolrSpellChecker

  A spellchecker that breaks and combines words.

  This will not combine adjacent tokens that do not have the same required status (prohibited, required, optional). However, this feature depends on incoming term flags being properly set. (`QueryConverter.PROHIBITED_TERM_FLAG`, `QueryConverter.REQUIRED_TERM_FLAG`, `QueryConverter.TERM_IN_BOOLEAN_QUERY_FLAG`, and `QueryConverter.TERM_PRECEDES_NEW_BOOLEAN_OPERATOR_FLAG` ) This feature breaks completely if the upstream analyzer or query converter sets flags with the same values but different meanings. The default query converter (if not using "spellcheck.q") is `SpellingQueryConverter`, which properly sets these flags.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WordBreakSolrSpellChecker.BreakSuggestionTieBreaker` Specify a value on the "breakSugestionTieBreaker" parameter.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PARAM_BREAK_SUGGESTION_TIE_BREAKER` See `WordBreakSolrSpellChecker.BreakSuggestionTieBreaker` for options.
    `static String` | `PARAM_BREAK_WORDS` Try to break words into multiples? [true|false]
    `static String` | `PARAM_COMBINE_WORDS` Try to combine multiple words into one? [true|false]
    `static String` | `PARAM_MAX_CHANGES` See `WordBreakSpellChecker.setMaxChanges(int)`
    `static String` | `PARAM_MAX_COMBINE_WORD_LENGTH` See `WordBreakSpellChecker.setMaxCombineWordLength(int)`
    `static String` | `PARAM_MAX_EVALUATIONS` See `WordBreakSpellChecker.setMaxEvaluations(int)`
    `static String` | `PARAM_MIN_BREAK_WORD_LENGTH` See `WordBreakSpellChecker.setMinBreakWordLength(int)`
    `static String` | `PARAM_MIN_SUGGESTION_FREQUENCY` See `WordBreakSpellChecker.setMinSuggestionFrequency(int)`

    - ### 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
    `WordBreakSolrSpellChecker()`

  - ### 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)`
    `boolean` | `isSuggestionsMayOverlap()`
    `void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the index.

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

      `getAccuracy, getDictionaryName, getQueryAnalyzer, getStringDistance, mergeSuggestions`

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

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

- - ### Field Detail

    - #### PARAM_COMBINE_WORDS

          public static final String PARAM_COMBINE_WORDS

      Try to combine multiple words into one? [true|false]

      See Also:
        Constant Field Values

    - #### PARAM_BREAK_WORDS

          public static final String PARAM_BREAK_WORDS

      Try to break words into multiples? [true|false]

      See Also:
        Constant Field Values

    - #### PARAM_MAX_CHANGES

          public static final String PARAM_MAX_CHANGES

      See `WordBreakSpellChecker.setMaxChanges(int)`
      See Also:
        Constant Field Values

    - #### PARAM_MAX_COMBINE_WORD_LENGTH

          public static final String PARAM_MAX_COMBINE_WORD_LENGTH

      See `WordBreakSpellChecker.setMaxCombineWordLength(int)`
      See Also:
        Constant Field Values

    - #### PARAM_MIN_BREAK_WORD_LENGTH

          public static final String PARAM_MIN_BREAK_WORD_LENGTH

      See `WordBreakSpellChecker.setMinBreakWordLength(int)`
      See Also:
        Constant Field Values

    - #### PARAM_BREAK_SUGGESTION_TIE_BREAKER

          public static final String PARAM_BREAK_SUGGESTION_TIE_BREAKER

      See `WordBreakSolrSpellChecker.BreakSuggestionTieBreaker` for options.
      See Also:
        Constant Field Values

    - #### PARAM_MAX_EVALUATIONS

          public static final String PARAM_MAX_EVALUATIONS

      See `WordBreakSpellChecker.setMaxEvaluations(int)`
      See Also:
        Constant Field Values

    - #### PARAM_MIN_SUGGESTION_FREQUENCY

          public static final String PARAM_MIN_SUGGESTION_FREQUENCY

      See `WordBreakSpellChecker.setMinSuggestionFrequency(int)`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### WordBreakSolrSpellChecker

          public WordBreakSolrSpellChecker()

  - ### Method Detail

    - #### init

          public String init(NamedList config,
                             SolrCore core)

      Overrides:
        `init` in class `SolrSpellChecker`

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

    - #### build

          public void build(SolrCore core,
                            SolrIndexSearcher searcher)

      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`

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

    - #### isSuggestionsMayOverlap

          public boolean isSuggestionsMayOverlap()

      Overrides:
        `isSuggestionsMayOverlap` in class `SolrSpellChecker`

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