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


Java MappedFieldType.tokenized方法代码示例

本文整理汇总了Java中org.elasticsearch.index.mapper.MappedFieldType.tokenized方法的典型用法代码示例。如果您正苦于以下问题:Java MappedFieldType.tokenized方法的具体用法?Java MappedFieldType.tokenized怎么用?Java MappedFieldType.tokenized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.index.mapper.MappedFieldType的用法示例。


在下文中一共展示了MappedFieldType.tokenized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newTermQuery

import org.elasticsearch.index.mapper.MappedFieldType; //导入方法依赖的package包/类
@Override
protected Query newTermQuery(Term term) {
    MappedFieldType currentFieldType = context.fieldMapper(term.field());
    if (currentFieldType == null || currentFieldType.tokenized()) {
        return super.newTermQuery(term);
    }
    return currentFieldType.termQuery(term.bytes(), context);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:SimpleQueryParser.java

示例2: StringFieldMapper

import org.elasticsearch.index.mapper.MappedFieldType; //导入方法依赖的package包/类
protected StringFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType,
                            int positionIncrementGap, int ignoreAbove,
                            Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
    super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, copyTo);
    if (fieldType.tokenized() && fieldType.indexOptions() != NONE && fieldType().hasDocValues()) {
        throw new MapperParsingException("Field [" + fieldType.names().fullName() + "] cannot be analyzed and have doc values");
    }
    this.positionIncrementGap = positionIncrementGap;
    this.ignoreAbove = ignoreAbove;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:StringFieldMapper.java

示例3: shardOperation

import org.elasticsearch.index.mapper.MappedFieldType; //导入方法依赖的package包/类
@Override
protected AnalyzeResponse shardOperation(AnalyzeRequest request, ShardId shardId) {
    try {
        final IndexService indexService;
        if (shardId != null) {
            indexService = indicesService.indexServiceSafe(shardId.getIndex());
        } else {
            indexService = null;
        }
        String field = null;
        Analyzer analyzer = null;
        if (request.field() != null) {
            if (indexService == null) {
                throw new IllegalArgumentException("No index provided, and trying to analyzer based on a specific field which requires the index parameter");
            }
            MappedFieldType fieldType = indexService.mapperService().fullName(request.field());
            if (fieldType != null) {
                if (fieldType.tokenized()) {
                    analyzer = fieldType.indexAnalyzer();
                } else if (fieldType instanceof KeywordFieldMapper.KeywordFieldType) {
                    analyzer = ((KeywordFieldMapper.KeywordFieldType) fieldType).normalizer();
                    if (analyzer == null) {
                        // this will be KeywordAnalyzer
                        analyzer = fieldType.indexAnalyzer();
                    }
                } else {
                    throw new IllegalArgumentException("Can't process field [" + request.field() + "], Analysis requests are only supported on tokenized fields");
                }
                field = fieldType.name();
            }
        }
        if (field == null) {
            if (indexService != null) {
                field = indexService.getIndexSettings().getDefaultField();
            } else {
                field = AllFieldMapper.NAME;
            }
        }
        final AnalysisRegistry analysisRegistry = indicesService.getAnalysis();
        return analyze(request, field, analyzer, indexService != null ? indexService.getIndexAnalyzers() : null, analysisRegistry, environment);
    } catch (IOException e) {
        throw new ElasticsearchException("analysis failed", e);
    }

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:46,代码来源:TransportAnalyzeAction.java


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