org.apache.solr.analysis
Class NGramTokenizerFactory

java.lang.Object
  extended by org.apache.solr.analysis.BaseTokenizerFactory
      extended by org.apache.solr.analysis.NGramTokenizerFactory
All Implemented Interfaces:
TokenizerFactory

public class NGramTokenizerFactory
extends BaseTokenizerFactory

Factory for NGramTokenizer.

 <fieldType name="text_ngrm" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
     <tokenizer class="solr.NGramTokenizerFactory" minGramSize="1" maxGramSize="2"/>
   </analyzer>
 </fieldType>

Version:
$Id$

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.BaseTokenizerFactory
log
 
Constructor Summary
NGramTokenizerFactory()
           
 
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.ngram.NGramTokenizer create(Reader input)
          Creates the TokenStream of n-grams from the given Reader.
 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)
          Initializes the n-gram min and max sizes and the side from which one should start tokenizing.
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.TokenizerFactory
getArgs
 

Field Detail

args

protected Map<String,String> args
The init args


luceneMatchVersion

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

Constructor Detail

NGramTokenizerFactory

public NGramTokenizerFactory()
Method Detail

init

public void init(Map<String,String> args)
Initializes the n-gram min and max sizes and the side from which one should start tokenizing.

Specified by:
init in interface TokenizerFactory

create

public org.apache.lucene.analysis.ngram.NGramTokenizer create(Reader input)
Creates the TokenStream of n-grams from the given Reader.


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.