org.apache.solr.analysis
Class SnowballPorterFilterFactory

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

public class SnowballPorterFilterFactory
extends BaseTokenFilterFactory
implements ResourceLoaderAware

Factory for SnowballFilter, with configurable language

Note: Use of the "Lovins" stemmer is not recommended, as it is implemented with reflection.

 <fieldType name="text_snowballstem" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
     <tokenizer class="solr.StandardTokenizerFactory"/>
     <filter class="solr.LowerCaseFilterFactory"/>
     <filter class="solr.SnowballPorterFilterFactory" protected="protectedkeyword.txt" language="English"/>
   </analyzer>
 </fieldType>

Version:
$Id: SnowballPorterFilterFactory.java 1074243 2011-02-24 18:07:16Z rmuir $

Field Summary
protected  Map<String,String> args
          The init args
protected  Version luceneMatchVersion
          the luceneVersion arg
static String PROTECTED_TOKENS
           
 
Fields inherited from class org.apache.solr.analysis.BaseTokenFilterFactory
log
 
Constructor Summary
SnowballPorterFilterFactory()
           
 
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
 TokenFilter create(TokenStream input)
          Transform the specified input 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  CharArraySet getSnowballWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase)
          same as getWordSet(ResourceLoader, String, boolean), except the input is in snowball format.
protected  CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase)
           
 void inform(ResourceLoader loader)
           
 void init(Map<String,String> args)
          init will be called just once, immediately after creation.
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
 

Field Detail

PROTECTED_TOKENS

public static final String PROTECTED_TOKENS
See Also:
Constant Field Values

args

protected Map<String,String> args
The init args


luceneMatchVersion

protected Version luceneMatchVersion
the luceneVersion arg

Constructor Detail

SnowballPorterFilterFactory

public SnowballPorterFilterFactory()
Method Detail

inform

public void inform(ResourceLoader loader)
Specified by:
inform in interface ResourceLoaderAware

init

public void init(Map<String,String> args)
Description copied from interface: TokenFilterFactory
init will be called just once, immediately after creation.

The args are user-level initialization parameters that may be specified when declaring the factory in the schema.xml

Specified by:
init in interface TokenFilterFactory

create

public TokenFilter create(TokenStream input)
Description copied from interface: TokenFilterFactory
Transform the specified input TokenStream

Specified by:
create in interface TokenFilterFactory

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 CharArraySet getWordSet(ResourceLoader loader,
                                  String wordFiles,
                                  boolean ignoreCase)
                           throws IOException
Throws:
IOException

getSnowballWordSet

protected CharArraySet getSnowballWordSet(ResourceLoader loader,
                                          String wordFiles,
                                          boolean ignoreCase)
                                   throws IOException
same as getWordSet(ResourceLoader, String, boolean), except the input is in snowball format.

Throws:
IOException