Skip to content

Commit

Permalink
Fix incorrect references to 'zero_terms_docs' in query parsing error …
Browse files Browse the repository at this point in the history
…messages. (#29599)
  • Loading branch information
jtibshirani authored Apr 19, 2018
1 parent 4f282e9 commit 00d88a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,14 @@ public static MatchQueryBuilder fromXContent(XContentParser parser) throws IOExc
} else if (CUTOFF_FREQUENCY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
cutOffFrequency = parser.floatValue();
} else if (ZERO_TERMS_QUERY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
String zeroTermsDocs = parser.text();
if ("none".equalsIgnoreCase(zeroTermsDocs)) {
String zeroTermsValue = parser.text();
if ("none".equalsIgnoreCase(zeroTermsValue)) {
zeroTermsQuery = MatchQuery.ZeroTermsQuery.NONE;
} else if ("all".equalsIgnoreCase(zeroTermsDocs)) {
} else if ("all".equalsIgnoreCase(zeroTermsValue)) {
zeroTermsQuery = MatchQuery.ZeroTermsQuery.ALL;
} else {
throw new ParsingException(parser.getTokenLocation(),
"Unsupported zero_terms_docs value [" + zeroTermsDocs + "]");
"Unsupported zero_terms_query value [" + zeroTermsValue + "]");
}
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
queryName = parser.text();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,14 @@ public static MultiMatchQueryBuilder fromXContent(XContentParser parser) throws
} else if (LENIENT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
lenient = parser.booleanValue();
} else if (ZERO_TERMS_QUERY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
String zeroTermsDocs = parser.text();
if ("none".equalsIgnoreCase(zeroTermsDocs)) {
String zeroTermsValue = parser.text();
if ("none".equalsIgnoreCase(zeroTermsValue)) {
zeroTermsQuery = MatchQuery.ZeroTermsQuery.NONE;
} else if ("all".equalsIgnoreCase(zeroTermsDocs)) {
} else if ("all".equalsIgnoreCase(zeroTermsValue)) {
zeroTermsQuery = MatchQuery.ZeroTermsQuery.ALL;
} else {
throw new ParsingException(parser.getTokenLocation(), "Unsupported zero_terms_docs value [" + zeroTermsDocs + "]");
throw new ParsingException(parser.getTokenLocation(),
"Unsupported zero_terms_query value [" + zeroTermsValue + "]");
}
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
queryName = parser.text();
Expand Down

0 comments on commit 00d88a5

Please sign in to comment.