当前位置: 首页>>代码示例>>Java>>正文


Java AnalysisModule.getAnalysisRegistry方法代码示例

本文整理汇总了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));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ESTestCase.java

示例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();
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-hyphen,代码行数:12,代码来源:MapperTestUtils.java

示例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);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-hyphen,代码行数:31,代码来源:MapperTestUtils.java

示例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);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-reference,代码行数:36,代码来源:MapperTestUtils.java

示例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();
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:12,代码来源:MapperTestUtils.java

示例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);
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:36,代码来源:MapperTestUtils.java


注:本文中的org.elasticsearch.indices.analysis.AnalysisModule.getAnalysisRegistry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。