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

Java SimilarityLookupService类代码示例

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

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



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

示例1: checkMappingsCompatibility

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的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


示例2: newDocumentMapperParser

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings settings) {
    Settings forcedSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(settings)
            .build();
    SimilarityLookupService similarityLookupService = newSimilarityLookupService(forcedSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    MapperService mapperService = new MapperService(new Index("test"),
            forcedSettings,
            newAnalysisService(forcedSettings),
            similarityLookupService,
            null,
            mapperRegistry);
    return new DocumentMapperParser(
            forcedSettings,
            mapperService,
            newAnalysisService(forcedSettings),
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:24,代码来源:MapperTestUtils.java


示例3: setupMapperParser

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
@Before
public void setupMapperParser() {
    Index index = new Index("test");

    Map<String, AnalyzerProviderFactory> analyzerFactoryFactories = Maps.newHashMap();
    analyzerFactoryFactories.put("keyword", new PreBuiltAnalyzerProviderFactory("keyword", AnalyzerScope.INDEX, new KeywordAnalyzer()));
    AnalysisService analysisService = new AnalysisService(index, ImmutableSettings.Builder.EMPTY_SETTINGS, null, analyzerFactoryFactories, null, null, null);

    mapperParser = new DocumentMapperParser(index, analysisService, new PostingsFormatService(index),
            new SimilarityLookupService(index, ImmutableSettings.Builder.EMPTY_SETTINGS));
    Settings settings = settingsBuilder()
            .put("opennlp.models.name.file", "src/test/resources/models/en-ner-person.bin")
            .put("opennlp.models.date.file", "src/test/resources/models/en-ner-date.bin")
            .put("opennlp.models.location.file", "src/test/resources/models/en-ner-location.bin")
            .build();

    LogConfigurator.configure(settings);

    OpenNlpService openNlpService = new OpenNlpService(settings);
    openNlpService.start();
    mapperParser.putTypeParser(OpenNlpMapper.CONTENT_TYPE, new OpenNlpMapper.TypeParser(analysisService, openNlpService));
}
 
开发者ID:spinscale,项目名称:elasticsearch-opennlp-plugin,代码行数:23,代码来源:OpenNlpMappingTest.java


示例4: DocumentMapperParser

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public DocumentMapperParser(Settings indexSettings, MapperService mapperService, AnalysisService analysisService,
                            SimilarityLookupService similarityLookupService, ScriptService scriptService,
                            MapperRegistry mapperRegistry,
                            @Nullable DynamicArrayFieldMapperBuilderFactory dynamicArrayFieldMapperBuilderFactory) {
    this.dynamicArrayFieldMapperBuilderFactory = dynamicArrayFieldMapperBuilderFactory;
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.scriptService = scriptService;
    this.mapperService = mapperService;
    this.analysisService = analysisService;
    this.similarityLookupService = similarityLookupService;
    this.typeParsers = mapperRegistry.getMapperParsers();
    this.rootTypeParsers = mapperRegistry.getMetadataMapperParsers();
    indexVersionCreated = Version.indexCreated(indexSettings);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:DocumentMapperParser.java


示例5: MapperService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public MapperService(Index index, Settings indexSettings, AnalysisService analysisService,
                     SimilarityLookupService similarityLookupService,
                     ScriptService scriptService, MapperRegistry mapperRegistry,
                     DynamicArrayFieldMapperBuilderFactoryProvider dynamicArrayFieldMapperBuilderFactoryProvider) {
    this(index, new IndexSettingsService(index, indexSettings), analysisService, similarityLookupService, scriptService,
        mapperRegistry, dynamicArrayFieldMapperBuilderFactoryProvider);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:MapperService.java


示例6: innerToXContent

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
private void innerToXContent(XContentBuilder builder, boolean includeDefaults) throws IOException {
    if (includeDefaults || enabledState != Defaults.ENABLED) {
        builder.field("enabled", enabledState.enabled);
    }
    if (includeDefaults || fieldType().stored() != Defaults.FIELD_TYPE.stored()) {
        builder.field("store", fieldType().stored());
    }
    if (includeDefaults || fieldType().storeTermVectors() != Defaults.FIELD_TYPE.storeTermVectors()) {
        builder.field("store_term_vectors", fieldType().storeTermVectors());
    }
    if (includeDefaults || fieldType().storeTermVectorOffsets() != Defaults.FIELD_TYPE.storeTermVectorOffsets()) {
        builder.field("store_term_vector_offsets", fieldType().storeTermVectorOffsets());
    }
    if (includeDefaults || fieldType().storeTermVectorPositions() != Defaults.FIELD_TYPE.storeTermVectorPositions()) {
        builder.field("store_term_vector_positions", fieldType().storeTermVectorPositions());
    }
    if (includeDefaults || fieldType().storeTermVectorPayloads() != Defaults.FIELD_TYPE.storeTermVectorPayloads()) {
        builder.field("store_term_vector_payloads", fieldType().storeTermVectorPayloads());
    }
    if (includeDefaults || fieldType().omitNorms() != Defaults.FIELD_TYPE.omitNorms()) {
        builder.field("omit_norms", fieldType().omitNorms());
    }
    
    doXContentAnalyzers(builder, includeDefaults);

    if (fieldType().similarity() != null) {
        builder.field("similarity", fieldType().similarity().name());
    } else if (includeDefaults) {
        builder.field("similarity", SimilarityLookupService.DEFAULT_SIMILARITY);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:32,代码来源:AllFieldMapper.java


示例7: ParserContext

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public ParserContext(String type, AnalysisService analysisService, SimilarityLookupService similarityLookupService,
                     MapperService mapperService, Map<String, TypeParser> typeParsers,
                     Version indexVersionCreated, ParseFieldMatcher parseFieldMatcher) {
    this.type = type;
    this.analysisService = analysisService;
    this.similarityLookupService = similarityLookupService;
    this.mapperService = mapperService;
    this.typeParsers = typeParsers;
    this.indexVersionCreated = indexVersionCreated;
    this.parseFieldMatcher = parseFieldMatcher;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:Mapper.java


示例8: newMapper

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public static MapperService newMapper(Settings settings) {
    Settings indexSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put(settings)
            .build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder()
            .add(new SettingsModule(indexSettings),
                    new EnvironmentModule(new Environment(indexSettings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(indexSettings,
            parentInjector.getInstance(IndicesAnalysisService.class));
    new EudexPlugin(settings).onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(new IndexSettingsModule(index, indexSettings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);
    AnalysisService analysisService = injector.getInstance(AnalysisService.class);
    SimilarityLookupService similarityLookupService = new SimilarityLookupService(index, indexSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    return new MapperService(new Index("test"),
            indexSettings,
            analysisService,
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-phonetic-eudex,代码行数:32,代码来源:MapperTestUtils.java


示例9: newMapperService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public static MapperService newMapperService(Settings settings) {
    Settings indexSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put(settings)
            .build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder()
            .add(new SettingsModule(indexSettings),
                    new EnvironmentModule(new Environment(indexSettings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(indexSettings,
            parentInjector.getInstance(IndicesAnalysisService.class));
    new OpenNLPAnalysisPlugin().onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(new IndexSettingsModule(index, indexSettings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);
    AnalysisService analysisService = injector.getInstance(AnalysisService.class);
    SimilarityLookupService similarityLookupService = new SimilarityLookupService(index, indexSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    return new MapperService(new Index("test"),
            indexSettings,
            analysisService,
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:32,代码来源:MapperTestUtils.java


示例10: newMapperService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public static MapperService newMapperService(Settings settings, Client client) {
    Settings indexSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put(settings)
            .build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder()
            .add(new SettingsModule(indexSettings),
            new EnvironmentModule(new Environment(indexSettings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(indexSettings,
            parentInjector.getInstance(IndicesAnalysisService.class));
    new AnalysisBaseformPlugin(settings).onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(new IndexSettingsModule(index, indexSettings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);
    AnalysisService analysisService = injector.getInstance(AnalysisService.class);
    SimilarityLookupService similarityLookupService = new SimilarityLookupService(index, indexSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    return new MapperService(new Index("test"),
            indexSettings,
            analysisService,
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-baseform,代码行数:32,代码来源:MapperTestUtils.java


示例11: createMapperParser

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
private DocumentMapperParser createMapperParser(Settings fromSettings) throws IOException {
    Index index = new Index("test");
    Settings settings = ImmutableSettings.settingsBuilder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(fromSettings)
            .build();
    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);
    AnalysisService service =injector.getInstance(AnalysisService.class);
    DocumentMapperParser mapperParser = new DocumentMapperParser(index,
            settings,
            service,
            new PostingsFormatService(index),
            new DocValuesFormatService(index),
            new SimilarityLookupService(index, settings),
            null
    );
    mapperParser.putTypeParser(LangdetectMapper.CONTENT_TYPE, new LangdetectMapper.TypeParser());
    return mapperParser;
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:30,代码来源:LangdetectMappingTests.java


示例12: doXContentBody

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {

        builder.field("type", contentType());
        if (indexCreatedBefore2x && (includeDefaults || !simpleName().equals(fieldType().names().originalIndexName()))) {
            builder.field("index_name", fieldType().names().originalIndexName());
        }

        if (includeDefaults || fieldType().boost() != 1.0f) {
            builder.field("boost", fieldType().boost());
        }

        boolean indexed =  fieldType().indexOptions() != IndexOptions.NONE;
        boolean defaultIndexed = defaultFieldType.indexOptions() != IndexOptions.NONE;
        if (includeDefaults || indexed != defaultIndexed ||
            fieldType().tokenized() != defaultFieldType.tokenized()) {
            builder.field("index", indexTokenizeOptionToString(indexed, fieldType().tokenized()));
        }
        if (includeDefaults || fieldType().stored() != defaultFieldType.stored()) {
            builder.field("store", fieldType().stored());
        }
        doXContentDocValues(builder, includeDefaults);
        if (includeDefaults || fieldType().storeTermVectors() != defaultFieldType.storeTermVectors()) {
            builder.field("term_vector", termVectorOptionsToString(fieldType()));
        }
        if (includeDefaults || fieldType().omitNorms() != defaultFieldType.omitNorms() || fieldType().normsLoading() != null) {
            builder.startObject("norms");
            if (includeDefaults || fieldType().omitNorms() != defaultFieldType.omitNorms()) {
                builder.field("enabled", !fieldType().omitNorms());
            }
            if (fieldType().normsLoading() != null) {
                builder.field(MappedFieldType.Loading.KEY, fieldType().normsLoading());
            }
            builder.endObject();
        }
        if (indexed && (includeDefaults || fieldType().indexOptions() != defaultFieldType.indexOptions())) {
            builder.field("index_options", indexOptionToString(fieldType().indexOptions()));
        }

        if (fieldType().similarity() != null) {
            builder.field("similarity", fieldType().similarity().name());
        } else if (includeDefaults) {
            builder.field("similarity", SimilarityLookupService.DEFAULT_SIMILARITY);
        }

        if (includeDefaults || hasCustomFieldDataSettings()) {
            builder.field("fielddata", fieldType().fieldDataType().getSettings().getAsMap());
        }
        multiFields.toXContent(builder, params);

        if (copyTo != null) {
            copyTo.toXContent(builder, params);
        }
    }
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:54,代码来源:FieldMapper.java


示例13: similarityLookupService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public SimilarityLookupService similarityLookupService() {
    return similarityLookupService;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:Mapper.java


示例14: newSimilarityLookupService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
private static SimilarityLookupService newSimilarityLookupService(Settings indexSettings) {
    return new SimilarityLookupService(new Index("test"), indexSettings);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:MapperTestUtils.java


示例15: newSimilarityLookupService

import org.elasticsearch.index.similarity.SimilarityLookupService; //导入依赖的package包/类
public static SimilarityLookupService newSimilarityLookupService(Settings indexSettings) {
    return new SimilarityLookupService(new Index("test"), indexSettings);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:4,代码来源:MapperTestUtils.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DFloNum类代码示例发布时间:2022-05-22
下一篇:
Java TextFileOutputMeta类代码示例发布时间: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