Package org.elasticsearch.index.analysis
Class AnalysisRegistry
java.lang.Object
org.elasticsearch.index.analysis.AnalysisRegistry
- All Implemented Interfaces:
Closeable
,AutoCloseable
An internal registry for tokenizer, token filter, char filter and analyzer.
This class exists per node and allows to create per-index
IndexAnalyzers
via build(IndexSettings)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAnalysisRegistry(Environment environment, Map<String,AnalysisModule.AnalysisProvider<CharFilterFactory>> charFilters, Map<String,AnalysisModule.AnalysisProvider<TokenFilterFactory>> tokenFilters, Map<String,AnalysisModule.AnalysisProvider<TokenizerFactory>> tokenizers, Map<String,AnalysisModule.AnalysisProvider<AnalyzerProvider<?>>> analyzers, Map<String,AnalysisModule.AnalysisProvider<AnalyzerProvider<?>>> normalizers, Map<String,PreConfiguredCharFilter> preConfiguredCharFilters, Map<String,PreConfiguredTokenFilter> preConfiguredTokenFilters, Map<String,PreConfiguredTokenizer> preConfiguredTokenizers, Map<String,PreBuiltAnalyzerProviderFactory> preConfiguredAnalyzers)
-
Method Summary
Modifier and TypeMethodDescriptionbuild(IndexSettings indexSettings)
Creates an index-levelIndexAnalyzers
from this registry using the given index settingsbuild(IndexSettings indexSettings, Map<String,AnalyzerProvider<?>> analyzerProviders, Map<String,AnalyzerProvider<?>> normalizerProviders, Map<String,TokenizerFactory> tokenizerFactoryFactories, Map<String,CharFilterFactory> charFilterFactoryFactories, Map<String,TokenFilterFactory> tokenFilterFactoryFactories)
buildCharFilterFactories(IndexSettings indexSettings)
buildCustomAnalyzer(IndexSettings indexSettings, boolean normalizer, NameOrDefinition tokenizer, List<NameOrDefinition> charFilters, List<NameOrDefinition> tokenFilters)
Creates a custom analyzer from a collection ofNameOrDefinition
specifications for each component Callers are responsible for closing the returned AnalyzerbuildTokenFilterFactories(IndexSettings indexSettings)
buildTokenizerFactories(IndexSettings indexSettings)
void
close()
org.apache.lucene.analysis.Analyzer
getAnalyzer(String analyzer)
Returns a registeredAnalyzer
provider by name ornull
if the analyzer was not registered
-
Field Details
-
INDEX_ANALYSIS_CHAR_FILTER
- See Also:
- Constant Field Values
-
INDEX_ANALYSIS_FILTER
- See Also:
- Constant Field Values
-
INDEX_ANALYSIS_TOKENIZER
- See Also:
- Constant Field Values
-
DEFAULT_ANALYZER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_SEARCH_ANALYZER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_SEARCH_QUOTED_ANALYZER_NAME
- See Also:
- Constant Field Values
-
-
Constructor Details
-
AnalysisRegistry
public AnalysisRegistry(Environment environment, Map<String,AnalysisModule.AnalysisProvider<CharFilterFactory>> charFilters, Map<String,AnalysisModule.AnalysisProvider<TokenFilterFactory>> tokenFilters, Map<String,AnalysisModule.AnalysisProvider<TokenizerFactory>> tokenizers, Map<String,AnalysisModule.AnalysisProvider<AnalyzerProvider<?>>> analyzers, Map<String,AnalysisModule.AnalysisProvider<AnalyzerProvider<?>>> normalizers, Map<String,PreConfiguredCharFilter> preConfiguredCharFilters, Map<String,PreConfiguredTokenFilter> preConfiguredTokenFilters, Map<String,PreConfiguredTokenizer> preConfiguredTokenizers, Map<String,PreBuiltAnalyzerProviderFactory> preConfiguredAnalyzers)
-
-
Method Details
-
getAnalyzer
Returns a registeredAnalyzer
provider by name ornull
if the analyzer was not registered- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
build
Creates an index-levelIndexAnalyzers
from this registry using the given index settings- Throws:
IOException
-
buildCustomAnalyzer
public NamedAnalyzer buildCustomAnalyzer(IndexSettings indexSettings, boolean normalizer, NameOrDefinition tokenizer, List<NameOrDefinition> charFilters, List<NameOrDefinition> tokenFilters) throws IOExceptionCreates a custom analyzer from a collection ofNameOrDefinition
specifications for each component Callers are responsible for closing the returned Analyzer- Throws:
IOException
-
buildTokenFilterFactories
public Map<String,TokenFilterFactory> buildTokenFilterFactories(IndexSettings indexSettings) throws IOException- Throws:
IOException
-
buildTokenizerFactories
public Map<String,TokenizerFactory> buildTokenizerFactories(IndexSettings indexSettings) throws IOException- Throws:
IOException
-
buildCharFilterFactories
public Map<String,CharFilterFactory> buildCharFilterFactories(IndexSettings indexSettings) throws IOException- Throws:
IOException
-
build
public IndexAnalyzers build(IndexSettings indexSettings, Map<String,AnalyzerProvider<?>> analyzerProviders, Map<String,AnalyzerProvider<?>> normalizerProviders, Map<String,TokenizerFactory> tokenizerFactoryFactories, Map<String,CharFilterFactory> charFilterFactoryFactories, Map<String,TokenFilterFactory> tokenFilterFactoryFactories)
-