Class HunspellService


  • public class HunspellService
    extends java.lang.Object
    Serves as a node level registry for hunspell dictionaries. This services expects all dictionaries to be located under the <path.conf>/hunspell directory, where each locale has its dedicated sub-directory which holds the dictionary files. For example, the dictionary files for en_US locale must be placed under <path.conf>/hunspell/en_US directory.

    The following settings can be set for each dictionary:

    • ignore_case - If true, dictionary matching will be case insensitive (defaults to false)
    • strict_affix_parsing - Determines whether errors while reading a affix rules file will cause exception or simple be ignored (defaults to true)

    These settings can either be configured as node level configuration, such as:

    
         indices.analysis.hunspell.dictionary.en_US.ignore_case: true
         indices.analysis.hunspell.dictionary.en_US.strict_affix_parsing: false
     

    or, as dedicated configuration per dictionary, placed in a settings.yml file under the dictionary directory. For example, the following can be the content of the <path.config>/hunspell/en_US/settings.yml file:

    
         ignore_case: true
         strict_affix_parsing: false
     
    See Also:
    HunspellTokenFilterFactory
    • Constructor Summary

      Constructors 
      Constructor Description
      HunspellService​(Settings settings, Environment env, java.util.Map<java.lang.String,​org.apache.lucene.analysis.hunspell.Dictionary> knownDictionaries)  
    • Method Summary

      Modifier and Type Method Description
      org.apache.lucene.analysis.hunspell.Dictionary getDictionary​(java.lang.String locale)
      Returns the hunspell dictionary for the given locale.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HUNSPELL_LAZY_LOAD

        public static final Setting<java.lang.Boolean> HUNSPELL_LAZY_LOAD
      • HUNSPELL_IGNORE_CASE

        public static final Setting<java.lang.Boolean> HUNSPELL_IGNORE_CASE
      • HUNSPELL_DICTIONARY_OPTIONS

        public static final Setting<Settings> HUNSPELL_DICTIONARY_OPTIONS
    • Constructor Detail

      • HunspellService

        public HunspellService​(Settings settings,
                               Environment env,
                               java.util.Map<java.lang.String,​org.apache.lucene.analysis.hunspell.Dictionary> knownDictionaries)
                        throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getDictionary

        public org.apache.lucene.analysis.hunspell.Dictionary getDictionary​(java.lang.String locale)
        Returns the hunspell dictionary for the given locale.
        Parameters:
        locale - The name of the locale