org.apache.lucene.analysis.hunspell
Class HunspellStemFilterFactory

java.lang.Object
  extended by org.apache.lucene.analysis.util.AbstractAnalysisFactory
      extended by org.apache.lucene.analysis.util.TokenFilterFactory
          extended by org.apache.lucene.analysis.hunspell.HunspellStemFilterFactory
All Implemented Interfaces:
ResourceLoaderAware

public class HunspellStemFilterFactory
extends TokenFilterFactory
implements ResourceLoaderAware

TokenFilterFactory that creates instances of HunspellStemFilter. Example config for British English including a custom dictionary, case insensitive matching:

 <filter class="solr.HunspellStemFilterFactory"
    dictionary="en_GB.dic,my_custom.dic"
    affix="en_GB.aff"
    ignoreCase="true" />
Both parameters dictionary and affix are mandatory.
The parameter ignoreCase (true/false) controls whether matching is case sensitive or not. Default false.
The parameter strictAffixParsing (true/false) controls whether the affix parsing is strict or not. Default true. If strict an error while reading an affix rule causes a ParseException, otherwise is ignored.
Dictionaries for many languages are available through the OpenOffice project. See http://wiki.apache.org/solr/Hunspell


Field Summary
 
Fields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
 
Constructor Summary
HunspellStemFilterFactory(Map<String,String> args)
          Creates a new HunspellStemFilterFactory
 
Method Summary
 TokenStream create(TokenStream tokenStream)
          Creates an instance of HunspellStemFilter that will filter the given TokenStream
 void inform(ResourceLoader loader)
          Loads the hunspell dictionary and affix files defined in the configuration
 
Methods inherited from class org.apache.lucene.analysis.util.TokenFilterFactory
availableTokenFilters, forName, lookupClass, reloadTokenFilters
 
Methods inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory
assureMatchVersion, get, get, get, get, get, getBoolean, getChar, getClassArg, getFloat, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSet, getSnowballWordSet, getWordSet, isExplicitLuceneMatchVersion, require, require, require, requireBoolean, requireChar, requireFloat, requireInt, setExplicitLuceneMatchVersion, splitFileNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HunspellStemFilterFactory

public HunspellStemFilterFactory(Map<String,String> args)
Creates a new HunspellStemFilterFactory

Method Detail

inform

public void inform(ResourceLoader loader)
            throws IOException
Loads the hunspell dictionary and affix files defined in the configuration

Specified by:
inform in interface ResourceLoaderAware
Parameters:
loader - ResourceLoader used to load the files
Throws:
IOException

create

public TokenStream create(TokenStream tokenStream)
Creates an instance of HunspellStemFilter that will filter the given TokenStream

Specified by:
create in class TokenFilterFactory
Parameters:
tokenStream - TokenStream that will be filtered
Returns:
HunspellStemFilter that filters the TokenStream


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