public abstract class AbstractAnalysisFactory extends Object
TokenizerFactory
,
TokenFilterFactory
and CharFilterFactory
.
The typical lifecycle for a factory consumer is:
setLuceneMatchVersion(Version)
init(Map)
passing arguments as key-value mappings.
ResourceLoaderAware.inform(ResourceLoader)
is called to initialize those resources.
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
args
The init args
|
protected Version |
luceneMatchVersion
the luceneVersion arg
|
Constructor and Description |
---|
AbstractAnalysisFactory() |
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 |
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 List<String> |
getLines(ResourceLoader loader,
String resource)
Returns the resource's lines (with content treated as UTF-8)
|
Version |
getLuceneMatchVersion() |
protected Pattern |
getPattern(String name)
Compiles a pattern for the value of the specified argument key
name |
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)
Returns as
CharArraySet from wordFiles, which
can be a comma-separated list of filenames |
void |
init(Map<String,String> args)
Initialize this factory via a set of key-value pairs.
|
void |
setLuceneMatchVersion(Version luceneMatchVersion) |
protected List<String> |
splitFileNames(String fileNames)
Splits file names separated by comma character.
|
protected Version luceneMatchVersion
public void init(Map<String,String> args)
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 requiredpublic void setLuceneMatchVersion(Version luceneMatchVersion)
public Version getLuceneMatchVersion()
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 Pattern getPattern(String name)
name
protected CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase) throws IOException
CharArraySet
from wordFiles, which
can be a comma-separated list of filenamesIOException
protected List<String> getLines(ResourceLoader loader, String resource) 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
protected List<String> splitFileNames(String fileNames)
fileNames
- the string containing file namesCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.