org.apache.solr.analysis
Class PhoneticFilterFactory

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

public class PhoneticFilterFactory
extends BaseTokenFilterFactory

Factory for PhoneticFilter. Create tokens based on phonetic encoders http://jakarta.apache.org/commons/codec/api-release/org/apache/commons/codec/language/package-summary.html This takes two arguments: "encoder" required, one of "DoubleMetaphone", "Metaphone", "Soundex", "RefinedSoundex" "inject" (default=true) add tokens to the stream with the offset=0

 <fieldType name="text_phonetic" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
     <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
   </analyzer>
 </fieldType>

Version:
$Id: PhoneticFilterFactory.java 1195102 2011-10-30 03:15:25Z rmuir $
See Also:
PhoneticFilter

Field Summary
protected  Map<String,String> args
          The init args
protected  org.apache.commons.codec.Encoder encoder
           
static String ENCODER
           
protected  boolean inject
           
static String INJECT
           
protected  org.apache.lucene.util.Version luceneMatchVersion
          the luceneVersion arg
protected  String name
           
 
Fields inherited from class org.apache.solr.analysis.BaseTokenFilterFactory
log
 
Constructor Summary
PhoneticFilterFactory()
           
 
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
 PhoneticFilter create(org.apache.lucene.analysis.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  org.apache.lucene.analysis.CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase)
           
 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

ENCODER

public static final String ENCODER
See Also:
Constant Field Values

INJECT

public static final String INJECT
See Also:
Constant Field Values

inject

protected boolean inject

name

protected String name

encoder

protected org.apache.commons.codec.Encoder encoder

args

protected Map<String,String> args
The init args


luceneMatchVersion

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

Constructor Detail

PhoneticFilterFactory

public PhoneticFilterFactory()
Method Detail

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 PhoneticFilter create(org.apache.lucene.analysis.TokenStream input)
Description copied from interface: TokenFilterFactory
Transform the specified input TokenStream


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.