Package org.apache.lucene.analysis
Class TokenizerFactory
java.lang.Object
org.apache.lucene.analysis.AbstractAnalysisFactory
org.apache.lucene.analysis.TokenizerFactory
- Direct Known Subclasses:
StandardTokenizerFactory
Abstract parent class for analysis factories that create
Tokenizer
instances.- Since:
- 3.1
-
Field Summary
Fields inherited from class org.apache.lucene.analysis.AbstractAnalysisFactory
LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion
-
Constructor Summary
ModifierConstructorDescriptionprotected
Default ctor for compatibility with SPIprotected
TokenizerFactory
(Map<String, String> args) Initialize this factory via a set of key-value pairs. -
Method Summary
Modifier and TypeMethodDescriptionreturns a list of all available tokenizer names from context classpathfinal Tokenizer
create()
Creates a TokenStream of the specified input using the default attribute factory.abstract Tokenizer
create
(AttributeFactory factory) Creates a TokenStream of the specified input using the given AttributeFactorystatic String
findSPIName
(Class<? extends TokenizerFactory> serviceClass) looks up a SPI name for the specified tokenizer factorystatic TokenizerFactory
looks up a tokenizer by name from context classpathstatic Class<? extends TokenizerFactory>
lookupClass
(String name) looks up a tokenizer class by name from context classpathstatic void
reloadTokenizers
(ClassLoader classloader) Reloads the factory list from the givenClassLoader
.Methods inherited from class org.apache.lucene.analysis.AbstractAnalysisFactory
defaultCtorException, get, get, get, get, get, getBoolean, getChar, getClassArg, getFloat, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSet, getSnowballWordSet, getWordSet, isExplicitLuceneMatchVersion, require, require, require, requireBoolean, requireChar, requireFloat, requireInt, setExplicitLuceneMatchVersion, splitAt, splitFileNames
-
Constructor Details
-
TokenizerFactory
protected TokenizerFactory()Default ctor for compatibility with SPI -
TokenizerFactory
Initialize this factory via a set of key-value pairs.
-
-
Method Details
-
forName
looks up a tokenizer by name from context classpath -
lookupClass
looks up a tokenizer class by name from context classpath -
availableTokenizers
returns a list of all available tokenizer names from context classpath -
findSPIName
looks up a SPI name for the specified tokenizer factory -
reloadTokenizers
Reloads the factory list from the givenClassLoader
. Changes to the factories are visible after the method ends, all iterators (availableTokenizers()
,...) stay consistent.NOTE: Only new factories are added, existing ones are never removed or replaced.
This method is expensive and should only be called for discovery of new factories on the given classpath/classloader!
-
create
Creates a TokenStream of the specified input using the default attribute factory. -
create
Creates a TokenStream of the specified input using the given AttributeFactory
-