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


Java QueryParseContext.reset方法代码示例

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


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

示例1: parse

import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext searchContext) throws Exception {
    QueryParseContext context = searchContext.queryParserService().getParseContext();
    context.reset(parser);
    Map<String, InnerHitsContext.BaseInnerHits> topLevelInnerHits = parseInnerHits(parser, context, searchContext);
    if (topLevelInnerHits != null) {
        InnerHitsContext innerHitsContext = searchContext.innerHits();
        innerHitsContext.addInnerHitDefinitions(topLevelInnerHits);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:InnerHitsParseElement.java

示例2: parseQuery

import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
private Query parseQuery(String type, XContentParser parser) {
    String[] previousTypes = null;
    if (type != null) {
        QueryParseContext.setTypesWithPrevious(new String[]{type});
    }
    QueryParseContext context = queryParserService.getParseContext();
    try {
        context.reset(parser);
        // This means that fields in the query need to exist in the mapping prior to registering this query
        // The reason that this is required, is that if a field doesn't exist then the query assumes defaults, which may be undesired.
        //
        // Even worse when fields mentioned in percolator queries do go added to map after the queries have been registered
        // then the percolator queries don't work as expected any more.
        //
        // Query parsing can't introduce new fields in mappings (which happens when registering a percolator query),
        // because field type can't be inferred from queries (like document do) so the best option here is to disallow
        // the usage of unmapped fields in percolator queries to avoid unexpected behaviour
        //
        // if index.percolator.map_unmapped_fields_as_string is set to true, query can contain unmapped fields which will be mapped
        // as an analyzed string.
        context.setAllowUnmappedFields(false);
        context.setMapUnmappedFieldAsString(mapUnmappedFieldsAsString ? true : false);
        return queryParserService.parseInnerQuery(context);
    } catch (IOException e) {
        throw new QueryParsingException(context, "Failed to parse", e);
    } finally {
        if (type != null) {
            QueryParseContext.setTypes(previousTypes);
        }
        context.reset(null);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:33,代码来源:PercolatorQueriesRegistry.java

示例3: validateAliasFilter

import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
private void validateAliasFilter(XContentParser parser, IndexQueryParserService indexQueryParserService) throws IOException {
    QueryParseContext context = indexQueryParserService.getParseContext();
    try {
        context.reset(parser);
        context.parseInnerFilter();
    } finally {
        context.reset(null);
        parser.close();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:AliasValidator.java


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