org.apache.solr.analysis
Class HunspellStemFilterFactory

java.lang.Object
  extended by org.apache.solr.analysis.BaseTokenFilterFactory
      extended by org.apache.solr.analysis.HunspellStemFilterFactory
All Implemented Interfaces:
TokenFilterFactory, ResourceLoaderAware

public class HunspellStemFilterFactory
extends BaseTokenFilterFactory
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.
Dictionaries for many languages are available through the OpenOffice project. See http://wiki.apache.org/solr/Hunspell


Field Summary
protected  Map<String,String> args
          The init args
protected  org.apache.lucene.util.Version luceneMatchVersion
          the luceneVersion arg
 
Fields inherited from class org.apache.solr.analysis.BaseTokenFilterFactory
log
 
Constructor Summary
HunspellStemFilterFactory()
           
 
Method Summary
protected  void assureMatchVersion()
          this method can be called in the TokenizerFactory.create(java.io.Reader) or TokenFilterFactory.create(org.apache.lucene.analysis.TokenStream) methods, to inform user, that for this factory a luceneMatchVersion is required
 org.apache.lucene.analysis.TokenStream create(org.apache.lucene.analysis.TokenStream tokenStream)
          Creates an instance of HunspellStemFilter that will filter the given TokenStream
 Map<String,String> getArgs()
           
protected  boolean getBoolean(String name, boolean defaultVal)
           
protected  boolean getBoolean(String name, boolean defaultVal, boolean useDefault)
           
protected  int getInt(String name)
           
protected  int getInt(String name, int defaultVal)
           
protected  int getInt(String name, int defaultVal, boolean useDefault)
           
protected  org.apache.lucene.analysis.CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase)
           
 void inform(ResourceLoader loader)
          Loads the hunspell dictionary and affix files defined in the configuration
 void init(Map<String,String> args)
           
protected  void warnDeprecated(String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.solr.analysis.TokenFilterFactory
getArgs, init
 

Field Detail

args

protected Map<String,String> args
The init args


luceneMatchVersion

protected org.apache.lucene.util.Version luceneMatchVersion
the luceneVersion arg

Constructor Detail

HunspellStemFilterFactory

public HunspellStemFilterFactory()
Method Detail

inform

public void inform(ResourceLoader loader)
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

create

public org.apache.lucene.analysis.TokenStream create(org.apache.lucene.analysis.TokenStream tokenStream)
Creates an instance of HunspellStemFilter that will filter the given TokenStream

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

init

public void init(Map<String,String> args)

getArgs

public Map<String,String> getArgs()

assureMatchVersion

protected final void assureMatchVersion()
this method can be called in the TokenizerFactory.create(java.io.Reader) or TokenFilterFactory.create(org.apache.lucene.analysis.TokenStream) methods, to inform user, that for this factory a luceneMatchVersion is required


warnDeprecated

protected final void warnDeprecated(String message)

getInt

protected int getInt(String name)

getInt

protected int getInt(String name,
                     int defaultVal)

getInt

protected int getInt(String name,
                     int defaultVal,
                     boolean useDefault)

getBoolean

protected boolean getBoolean(String name,
                             boolean defaultVal)

getBoolean

protected boolean getBoolean(String name,
                             boolean defaultVal,
                             boolean useDefault)

getWordSet

protected org.apache.lucene.analysis.CharArraySet getWordSet(ResourceLoader loader,
                                                             String wordFiles,
                                                             boolean ignoreCase)
                                                      throws IOException
Throws:
IOException


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