• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AnalysisService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.elasticsearch.index.analysis.AnalysisService的典型用法代码示例。如果您正苦于以下问题:Java AnalysisService类的具体用法?Java AnalysisService怎么用?Java AnalysisService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnalysisService类属于org.elasticsearch.index.analysis包,在下文中一共展示了AnalysisService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: IndexQueryParserService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Inject
public IndexQueryParserService(Index index, IndexSettingsService indexSettingsService,
                               IndicesQueriesRegistry indicesQueriesRegistry,
                               ScriptService scriptService, AnalysisService analysisService,
                               MapperService mapperService, IndexCache indexCache, IndexFieldDataService fieldDataService,
                               BitsetFilterCache bitsetFilterCache,
                               @Nullable SimilarityService similarityService) {
    super(index, indexSettingsService.getSettings());
    this.indexSettingsService = indexSettingsService;
    this.scriptService = scriptService;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.similarityService = similarityService;
    this.indexCache = indexCache;
    this.fieldDataService = fieldDataService;
    this.bitsetFilterCache = bitsetFilterCache;

    Settings indexSettings = indexSettingsService.getSettings();
    this.defaultField = indexSettings.get(DEFAULT_FIELD, AllFieldMapper.NAME);
    this.queryStringLenient = indexSettings.getAsBoolean(QUERY_STRING_LENIENT, false);
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.defaultAllowUnmappedFields = indexSettings.getAsBoolean(ALLOW_UNMAPPED, true);
    this.indicesQueriesRegistry = indicesQueriesRegistry;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:IndexQueryParserService.java


示例2: checkMappingsCompatibility

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
/**
 * Checks the mappings for compatibility with the current version
 */
private void checkMappingsCompatibility(IndexMetaData indexMetaData) {
    Index index = new Index(indexMetaData.getIndex());
    Settings settings = indexMetaData.getSettings();
    try {
        SimilarityLookupService similarityLookupService = new SimilarityLookupService(index, settings);
        // We cannot instantiate real analysis server at this point because the node might not have
        // been started yet. However, we don't really need real analyzers at this stage - so we can fake it
        try (AnalysisService analysisService = new FakeAnalysisService(index, settings)) {
            try (MapperService mapperService = new MapperService(index, settings, analysisService, similarityLookupService,
                    scriptService, mapperRegistry, dynamicArrayFieldMapperBuilderFactoryProvider)) {
                for (ObjectCursor<MappingMetaData> cursor : indexMetaData.getMappings().values()) {
                    MappingMetaData mappingMetaData = cursor.value;
                    mapperService.merge(mappingMetaData.type(), mappingMetaData.source(), MapperService.MergeReason.MAPPING_RECOVERY, false);
                }
            }
        }
    } catch (Exception ex) {
        // Wrap the inner exception so we have the index name in the exception message
        throw new IllegalStateException("unable to upgrade the mappings for the index [" + indexMetaData.getIndex() + "], reason: [" + ex.getMessage() + "]", ex);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:MetaDataIndexUpgradeService.java


示例3: testTokenizerFilter

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testTokenizerFilter() throws IOException {

    String source = "eins zwei drei";

    String[] expected = {
            "d800000000001214",
            "4a00000000000000",
            "c0000000000a100"
    };
    AnalysisService analysisService = MapperTestUtils.analysisService("eudex_analysis.json");
    TokenFilterFactory tokenFilterFactory = analysisService.tokenFilter("my_phonetic");
    Tokenizer tokenizer = analysisService.tokenizer("my_phonetic").create();
    tokenizer.setReader(new StringReader(source));
    assertSimpleTSOutput(tokenFilterFactory.create(tokenizer), expected);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-phonetic-eudex,代码行数:17,代码来源:EudexAnalyzerTests.java


示例4: testOpenNLPAnalysis

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testOpenNLPAnalysis() throws Exception {
    AnalysisService analysisService = MapperTestUtils.analysisService(getResource());
    TokenizerFactory tokenizerFactory = analysisService.tokenizer("opennlp");
    MatcherAssert.assertThat(tokenizerFactory, instanceOf(OpenNLPTokenizerFactory.class));
    this.tokenizerFactory = (OpenNLPTokenizerFactory) tokenizerFactory;
    TokenFilterFactory filterFactory = analysisService.tokenFilter("opennlp");
    MatcherAssert.assertThat(filterFactory, instanceOf(OpenNLPTokenFilterFactory.class));
    this.filterFactory = (OpenNLPTokenFilterFactory) filterFactory;

    TokenFilterFactory filterpayloadsfilterFactory = analysisService.tokenFilter("filterpayloads");
    MatcherAssert.assertThat(filterpayloadsfilterFactory, instanceOf(FilterPayloadsTokenFilterFactory.class));
    TokenFilterFactory strippayloadsfilterFactory = analysisService.tokenFilter("strippayloads");
    MatcherAssert.assertThat(strippayloadsfilterFactory, instanceOf(StripPayloadsTokenFilterFactory.class));

    analyze();
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:18,代码来源:BaseOpenNLPAnalysis.java


示例5: testBasicUsage

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testBasicUsage() throws Exception {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "tr")
            .put("index.analysis.analyzer.myAnalyzer.strength", "primary")
            .put("index.analysis.analyzer.myAnalyzer.decomposition", "canonical")
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsUpper = analyzer.tokenStream(null, "I WİLL USE TURKİSH CASING");
    BytesRef b1 = bytesFromTokenStream(tsUpper);
    TokenStream tsLower = analyzer.tokenStream(null, "ı will use turkish casıng");
    BytesRef b2 = bytesFromTokenStream(tsLower);
    assertTrue(compare(b1.bytes, b2.bytes) == 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuCollationAnalyzerTests.java


示例6: testNormalization

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testNormalization() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "tr")
            .put("index.analysis.analyzer.myAnalyzer.strength", "primary")
            .put("index.analysis.analyzer.myAnalyzer.decomposition", "canonical")
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsUpper = analyzer.tokenStream(null, "I W\u0049\u0307LL USE TURKİSH CASING");
    BytesRef b1 = bytesFromTokenStream(tsUpper);
    TokenStream tsLower = analyzer.tokenStream(null, "ı will use turkish casıng");
    BytesRef b2 = bytesFromTokenStream(tsLower);
    assertTrue(compare(b1.bytes, b2.bytes) == 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuCollationAnalyzerTests.java


示例7: testSecondaryStrength

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testSecondaryStrength() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "en")
            .put("index.analysis.analyzer.myAnalyzer.strength", "secondary")
            .put("index.analysis.analyzer.myAnalyzer.decomposition", "no")
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsUpper = analyzer.tokenStream("content", "TESTING");
    BytesRef b1 = bytesFromTokenStream(tsUpper);
    TokenStream tsLower = analyzer.tokenStream("content", "testing");
    BytesRef b2 = bytesFromTokenStream(tsLower);
    assertTrue(compare(b1.bytes, b2.bytes) == 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuCollationAnalyzerTests.java


示例8: testIgnorePunctuation

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testIgnorePunctuation() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "en")
            .put("index.analysis.analyzer.myAnalyzer.strength", "primary")
            .put("index.analysis.analyzer.myAnalyzer.alternate", "shifted")
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsPunctuation = analyzer.tokenStream("content", "foo-bar");
    BytesRef b1 = bytesFromTokenStream(tsPunctuation);
    TokenStream tsWithoutPunctuation = analyzer.tokenStream("content", "foo bar");
    BytesRef b2 = bytesFromTokenStream(tsWithoutPunctuation);
    assertTrue(compare(b1.bytes, b2.bytes) == 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuCollationAnalyzerTests.java


示例9: testIgnoreWhitespace

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testIgnoreWhitespace() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "en")
            .put("index.analysis.analyzer.myAnalyzer.strength", "primary")
            .put("index.analysis.analyzer.myAnalyzer.alternate", "shifted")
            .put("index.analysis.analyzer.myAnalyzer.variableTop", 4096) // SPACE
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsWithoutSpace = analyzer.tokenStream(null, "foobar");
    BytesRef b1 = bytesFromTokenStream(tsWithoutSpace);
    TokenStream tsWithSpace = analyzer.tokenStream(null, "foo bar");
    BytesRef b2 = bytesFromTokenStream(tsWithSpace);
    assertTrue(compare(b1.bytes, b2.bytes) == 0);

    // now assert that punctuation still matters: foo-bar < foo bar
    TokenStream tsWithPunctuation = analyzer.tokenStream(null, "foo-bar");
    BytesRef b3 = bytesFromTokenStream(tsWithPunctuation);
    assertTrue(compare(b3.bytes, b1.bytes) < 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:26,代码来源:IcuCollationAnalyzerTests.java


示例10: testNumerics

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testNumerics() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "en")
            .put("index.analysis.analyzer.myAnalyzer.numeric", true)
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    TokenStream tsNine = analyzer.tokenStream(null, "foobar-9");
    BytesRef b1 = bytesFromTokenStream(tsNine);
    TokenStream tsTen = analyzer.tokenStream(null, "foobar-10");
    BytesRef b2 = bytesFromTokenStream(tsTen);
    assertTrue(compare(b1.bytes, b2.bytes) == -1);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:19,代码来源:IcuCollationAnalyzerTests.java


示例11: testUpperCaseFirst

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testUpperCaseFirst() throws IOException {
    Index index = new Index("test");
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("index.analysis.analyzer.myAnalyzer.type", "icu_collation")
            .put("index.analysis.analyzer.myAnalyzer.language", "en")
            .put("index.analysis.analyzer.myAnalyzer.strength", "tertiary")
            .put("index.analysis.analyzer.myAnalyzer.caseFirst", "upper")
            .build();
    AnalysisService analysisService = createAnalysisService(index, settings);
    Analyzer analyzer = analysisService.analyzer("myAnalyzer").analyzer();
    String lower = "resume";
    String upper = "Resume";
    TokenStream tsLower = analyzer.tokenStream(null, lower);
    BytesRef b1 = bytesFromTokenStream(tsLower);
    TokenStream tsUpper = analyzer.tokenStream(null, upper);
    BytesRef b2 = bytesFromTokenStream(tsUpper);
    assertTrue(compare(b2.bytes, b1.bytes) < 0);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:22,代码来源:IcuCollationAnalyzerTests.java


示例12: createAnalysisService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
private AnalysisService createAnalysisService() {
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .loadFromStream("icu_folding.json", getClass().getResourceAsStream("/org/xbib/elasticsearch/index/analysis/icu/icu_folding.json")).build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
            new EnvironmentModule(new Environment(settings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class));
    new IcuPlugin(settings).onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(
            new IndexSettingsModule(index, settings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);

    return injector.getInstance(AnalysisService.class);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuCharFilterTests.java


示例13: testLetterNonBreak

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testLetterNonBreak() throws IOException {

    String source = "Das ist ein Bindestrich-Wort, oder etwa nicht? Jetzt kommen wir zum Ende.";

    String[] expected = {
            "Das",
            "ist",
            "ein",
            "Bindestrich-Wort",
            "oder",
            "etwa",
            "nicht",
            "Jetzt",
            "kommen",
            "wir",
            "zum",
            "Ende"
    };
    AnalysisService analysisService = createAnalysisService();
    Tokenizer tokenizer = analysisService.tokenizer("my_hyphen_icu_tokenizer").create();
    tokenizer.setReader(new StringReader(source));
    assertSimpleTSOutput(tokenizer, expected);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:25,代码来源:IcuTokenizerTests.java


示例14: createAnalysisService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
private AnalysisService createAnalysisService() {
    Settings settings = Settings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .loadFromStream("icu_tokenizer.json", getClass().getResourceAsStream("/org/xbib/elasticsearch/index/analysis/icu/icu_tokenizer.json")).build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
            new EnvironmentModule(new Environment(settings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class));
    new IcuPlugin(settings).onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(
            new IndexSettingsModule(index, settings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);

    return injector.getInstance(AnalysisService.class);
}
 
开发者ID:jprante,项目名称:elasticsearch-icu,代码行数:20,代码来源:IcuTokenizerTests.java


示例15: getAnalysisService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
private AnalysisService getAnalysisService() {
    Index index = new Index("test");

    Settings settings = ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build();
    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
            new EnvironmentModule(new Environment(settings)), new IndicesAnalysisModule()).createInjector();
    Injector injector = new ModulesBuilder().add(
            new IndexSettingsModule(index, settings),
            new IndexNameModule(index),
            new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class))
                    .addProcessor(new RosetteAnalysisBinderProcessor()))
            .createChildInjector(parentInjector);

    return injector.getInstance(AnalysisService.class);

}
 
开发者ID:basis-technology-corp,项目名称:elasticsearch-analysis-rosette,代码行数:17,代码来源:SimpleRosetteAnalysisTests.java


示例16: testTwo

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testTwo() throws IOException {

    String source = "Das sind Autos, die Nudeln transportieren.";

    String[] expected = {
            "Das",
            "Das",
            "sind",
            "sind",
            "Autos",
            "Auto",
            "die",
            "der",
            "Nudeln",
            "Nudel",
            "transportieren",
            "transportieren"
    };
    AnalysisService analysisService = MapperTestUtils.analysisService();
    TokenFilterFactory tokenFilter = analysisService.tokenFilter("baseform");
    Tokenizer tokenizer = analysisService.tokenizer("standard").create();
    tokenizer.setReader(new StringReader(source));
    assertSimpleTSOutput(tokenFilter.create(tokenizer), expected);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-baseform,代码行数:26,代码来源:BaseformTokenFilterTests.java


示例17: testThree

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testThree() throws IOException {

    String source = "wurde zum tollen gemacht";

    String[] expected = {
            "wurde",
            "werden",
            "zum",
            "zum",
            "tollen",
            "tollen",
            "gemacht",
            "machen"
    };
    AnalysisService analysisService = MapperTestUtils.analysisService();
    TokenFilterFactory tokenFilter = analysisService.tokenFilter("baseform");
    Tokenizer tokenizer = analysisService.tokenizer("standard").create();
    tokenizer.setReader(new StringReader(source));
    assertSimpleTSOutput(tokenFilter.create(tokenizer), expected);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-baseform,代码行数:22,代码来源:BaseformTokenFilterTests.java


示例18: createAnalysisService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
private AnalysisService createAnalysisService() {
    Settings settings = ImmutableSettings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .loadFromClasspath("org/xbib/elasticsearch/index/analysis/decompound/decompound_analysis.json").build();

    Index index = new Index("test");

    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
            new EnvironmentModule(new Environment(settings)),
            new IndicesAnalysisModule())
            .createInjector();

    AnalysisModule analysisModule = new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class));
    new AnalysisGermanPlugin().onModule(analysisModule);

    Injector injector = new ModulesBuilder().add(
            new IndexSettingsModule(index, settings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);

    return injector.getInstance(AnalysisService.class);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:24,代码来源:DecompoundTokenFilterTests.java


示例19: testTwo

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
@Test
public void testTwo() throws IOException {

    String source = "So wird's was: das Elasticsearch-Buch erscheint beim O'Reilly-Verlag.";

    String[] expected = {
            "so",
            "wird's",
            "was",
            "das",
            "elasticsearch-buch",
            "elasticsearchbuch",
            "buch",
            "elasticsearch",
            "erscheint",
            "beim",
            "o'reilly-verlag"
    };

    AnalysisService analysisService = createAnalysisService();
    Analyzer analyzer = analysisService.defaultAnalyzer();
    assertSimpleTSOutput(analyzer.tokenStream(null, new StringReader(source)), expected);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:24,代码来源:SettingsTests.java


示例20: createAnalysisService

import org.elasticsearch.index.analysis.AnalysisService; //导入依赖的package包/类
private AnalysisService createAnalysisService() {
    Settings settings = ImmutableSettings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .loadFromClasspath("org/xbib/elasticsearch/index/analysis/german/test-settings.json").build();

    Index index = new Index("test");

    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
            new EnvironmentModule(new Environment(settings)),
            new IndicesAnalysisModule())
            .createInjector();

    AnalysisModule analysisModule = new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class));
    new AnalysisGermanPlugin().onModule(analysisModule);

    Injector injector = new ModulesBuilder().add(
            new IndexSettingsModule(index, settings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);

    return injector.getInstance(AnalysisService.class);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:24,代码来源:SettingsTests.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Dependencies类代码示例发布时间:2022-05-22
下一篇:
Java Sprite类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap