本文整理匯總了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);
}
}
示例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);
}
}
示例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();
}
}