public class NGramTokenizerFactory extends BaseTokenizerFactory
NGramTokenizer
.
<fieldType name="text_ngrm" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.NGramTokenizerFactory" minGramSize="1" maxGramSize="2"/> </analyzer> </fieldType>
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
args
The init args
|
protected Version |
luceneMatchVersion
the luceneVersion arg
|
log
Constructor and Description |
---|
NGramTokenizerFactory() |
Modifier and Type | Method and Description |
---|---|
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 |
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 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 |
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getArgs
protected Version luceneMatchVersion
public void init(Map<String,String> args)
init
in interface TokenizerFactory
public NGramTokenizer create(Reader input)
TokenStream
of n-grams from the given Reader
.protected final void assureMatchVersion()
TokenizerFactory.create(java.io.Reader)
or TokenFilterFactory.create(org.apache.lucene.analysis.TokenStream)
methods,
to inform user, that for this factory a luceneMatchVersion
is requiredprotected final void warnDeprecated(String message)
protected int getInt(String name)
protected int getInt(String name, int defaultVal)
protected int getInt(String name, int defaultVal, boolean useDefault)
protected boolean getBoolean(String name, boolean defaultVal)
protected boolean getBoolean(String name, boolean defaultVal, boolean useDefault)
protected CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase) throws IOException
IOException
protected CharArraySet getSnowballWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase) throws IOException
getWordSet(ResourceLoader, String, boolean)
,
except the input is in snowball format.IOException