Skip to content

Commit

Permalink
Split parseInnerFilter(String) into bwc part and new method returning…
Browse files Browse the repository at this point in the history
… QueryBuilder
  • Loading branch information
cbuescher committed May 13, 2015
1 parent 81a529d commit d2583cf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/org/elasticsearch/index/query/QueryParseContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,30 @@ public QueryBuilder parseInnerFilterToQueryBuilder() throws QueryParsingExceptio
}
}

public Query parseInnerFilter(String queryName) throws IOException, QueryParsingException {
public QueryBuilder parseInnerFilterToQueryBuilder(String queryName) throws IOException, QueryParsingException {
final boolean originalIsFilter = isFilter;
try {
isFilter = true;
QueryParser queryParser = indexQueryParser.queryParser(queryName);
if (queryParser == null) {
throw new QueryParsingException(this, "No query registered for [" + queryName + "]");
}
return queryParser.parse(this);
return queryParser.fromXContent(this);
} finally {
isFilter = originalIsFilter;
}
}

/**
* @deprecated replaced by calls to parseInnerFilterToQueryBuilder(String queryName) for the resulting queries
*/
@Nullable
@Deprecated
public Query parseInnerFilter(String queryName) throws IOException, QueryParsingException {
QueryBuilder builder = parseInnerFilterToQueryBuilder(queryName);
return (builder != null) ? builder.toQuery(this) : null;
}

public FieldMapper fieldMapper(String name) {
FieldMappers fieldMappers = indexQueryParser.mapperService.smartNameFieldMappers(name, getTypes());
if (fieldMappers == null) {
Expand Down

0 comments on commit d2583cf

Please sign in to comment.