本文整理汇总了Java中org.elasticsearch.indices.analysis.AnalysisModule.getAnalysisRegistry方法的典型用法代码示例。如果您正苦于以下问题:Java AnalysisModule.getAnalysisRegistry方法的具体用法?Java AnalysisModule.getAnalysisRegistry怎么用?Java AnalysisModule.getAnalysisRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.indices.analysis.AnalysisModule
的用法示例。
在下文中一共展示了AnalysisModule.getAnalysisRegistry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTestAnalysis
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
/**
* Creates an TestAnalysis with all the default analyzers configured.
*/
public static TestAnalysis createTestAnalysis(IndexSettings indexSettings, Settings nodeSettings,
AnalysisPlugin... analysisPlugins) throws IOException {
Environment env = new Environment(nodeSettings);
AnalysisModule analysisModule = new AnalysisModule(env, Arrays.asList(analysisPlugins));
AnalysisRegistry analysisRegistry = analysisModule.getAnalysisRegistry();
return new TestAnalysis(analysisRegistry.build(indexSettings),
analysisRegistry.buildTokenFilterFactories(indexSettings),
analysisRegistry.buildTokenizerFactories(indexSettings),
analysisRegistry.buildCharFilterFactories(indexSettings));
}
示例2: analysisService
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
public static AnalysisRegistry analysisService(Settings customSettings) throws IOException {
Settings settings = Settings.builder()
.put("path.home", System.getProperty("path.home", "/tmp"))
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(customSettings)
.build();
Environment environment = new Environment(settings);
HyphenPlugin hyphenPlugin = new HyphenPlugin();
AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(hyphenPlugin));
return analysisModule.getAnalysisRegistry();
}
示例3: newDocumentMapperParser
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings customSettings, String index) throws IOException {
Settings settings = Settings.builder()
.put("path.home", System.getProperty("path.home", "/tmp"))
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(customSettings)
.build();
Environment environment = new Environment(settings);
HyphenPlugin hyphenPlugin = new HyphenPlugin();
AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(hyphenPlugin));
IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
AnalysisRegistry analysisRegistry = analysisModule.getAnalysisRegistry();
IndexMetaData indexMetaData = IndexMetaData.builder(index)
.settings(settings)
.numberOfShards(1)
.numberOfReplicas(1)
.build();
IndexSettings indexSettings = new IndexSettings(indexMetaData, settings);
SimilarityService similarityService = new SimilarityService(indexSettings, SimilarityService.BUILT_IN);
Map<String, CharFilterFactory> charFilterFactoryMap = analysisRegistry.buildCharFilterFactories(indexSettings);
Map<String, TokenFilterFactory> tokenFilterFactoryMap = analysisRegistry.buildTokenFilterFactories(indexSettings);
Map<String, TokenizerFactory> tokenizerFactoryMap = analysisRegistry.buildTokenizerFactories(indexSettings);
Map<String, AnalyzerProvider<?>> analyzerProviderMap = analysisRegistry.buildAnalyzerFactories(indexSettings);
IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings, analyzerProviderMap,
tokenizerFactoryMap, charFilterFactoryMap, tokenFilterFactoryMap);
MapperService mapperService = new MapperService(indexSettings, indexAnalyzers,
similarityService, mapperRegistry, null);
return new DocumentMapperParser(indexSettings,
mapperService, indexAnalyzers, similarityService, mapperRegistry, null);
}
示例4: newDocumentMapperParser
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings customSettings, String index) throws IOException {
Settings settings = Settings.builder()
.put("path.home", System.getProperty("path.home", System.getProperty("user.dir")))
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(customSettings)
.build();
Environment environment = new Environment(settings);
ReferencePlugin referencePlugin = new ReferencePlugin();
AnalysisModule analysisModule = new AnalysisModule(environment, Collections.emptyList());
IndicesModule indicesModule = new IndicesModule(Collections.singletonList(referencePlugin));
MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
AnalysisRegistry analysisRegistry = analysisModule.getAnalysisRegistry();
IndexMetaData indexMetaData = IndexMetaData.builder(index)
.settings(settings)
.numberOfShards(1)
.numberOfReplicas(1)
.build();
IndexSettings indexSettings = new IndexSettings(indexMetaData, settings);
SimilarityService similarityService = new SimilarityService(indexSettings, SimilarityService.BUILT_IN);
Map<String, CharFilterFactory> charFilterFactoryMap = analysisRegistry.buildCharFilterFactories(indexSettings);
Map<String, TokenFilterFactory> tokenFilterFactoryMap = analysisRegistry.buildTokenFilterFactories(indexSettings);
Map<String, TokenizerFactory> tokenizerFactoryMap = analysisRegistry.buildTokenizerFactories(indexSettings);
Map<String, AnalyzerProvider<?>> analyzerProviderMap = analysisRegistry.buildAnalyzerFactories(indexSettings);
Map<String, AnalyzerProvider<?>> normalizerProviderMap = analysisRegistry.buildNormalizerFactories(indexSettings);
IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings,
analyzerProviderMap,
normalizerProviderMap,
tokenizerFactoryMap,
charFilterFactoryMap,
tokenFilterFactoryMap);
MapperService mapperService = new MapperService(indexSettings, indexAnalyzers, NamedXContentRegistry.EMPTY,
similarityService, mapperRegistry, null);
return new DocumentMapperParser(indexSettings, mapperService, indexAnalyzers, NamedXContentRegistry.EMPTY,
similarityService, mapperRegistry, null);
}
示例5: analysisService
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
public static AnalysisRegistry analysisService(Settings customSettings) throws IOException {
Settings settings = Settings.builder()
.put("path.home", System.getProperty("path.home", "/tmp"))
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(customSettings)
.build();
Environment environment = new Environment(settings);
BundlePlugin bundlePlugin = new BundlePlugin(settings);
AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(bundlePlugin));
return analysisModule.getAnalysisRegistry();
}
示例6: newDocumentMapperParser
import org.elasticsearch.indices.analysis.AnalysisModule; //导入方法依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings customSettings, String index) throws IOException {
Settings settings = Settings.builder()
.put("path.home", System.getProperty("path.home", "/tmp"))
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(customSettings)
.build();
Environment environment = new Environment(settings);
BundlePlugin bundlePlugin = new BundlePlugin(settings);
AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(bundlePlugin));
IndicesModule indicesModule = new IndicesModule(Collections.singletonList(bundlePlugin));
MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
AnalysisRegistry analysisRegistry = analysisModule.getAnalysisRegistry();
IndexMetaData indexMetaData = IndexMetaData.builder(index)
.settings(settings)
.numberOfShards(1)
.numberOfReplicas(1)
.build();
IndexSettings indexSettings = new IndexSettings(indexMetaData, settings);
SimilarityService similarityService = new SimilarityService(indexSettings, SimilarityService.BUILT_IN);
Map<String, CharFilterFactory> charFilterFactoryMap = analysisRegistry.buildCharFilterFactories(indexSettings);
Map<String, TokenFilterFactory> tokenFilterFactoryMap = analysisRegistry.buildTokenFilterFactories(indexSettings);
Map<String, TokenizerFactory> tokenizerFactoryMap = analysisRegistry.buildTokenizerFactories(indexSettings);
Map<String, AnalyzerProvider<?>> analyzerProviderMap = analysisRegistry.buildAnalyzerFactories(indexSettings);
Map<String, AnalyzerProvider<?>> normalizerProviderMap = analysisRegistry.buildNormalizerFactories(indexSettings);
IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings,
analyzerProviderMap,
normalizerProviderMap,
tokenizerFactoryMap,
charFilterFactoryMap,
tokenFilterFactoryMap);
MapperService mapperService = new MapperService(indexSettings, indexAnalyzers, NamedXContentRegistry.EMPTY,
similarityService, mapperRegistry, null);
return new DocumentMapperParser(indexSettings, mapperService, indexAnalyzers, NamedXContentRegistry.EMPTY,
similarityService, mapperRegistry, null);
}