Skip to content

Commit

Permalink
Fix field parsing in fromXContent
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Jul 31, 2024
1 parent 6617c87 commit 2ce46c4
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public TermsQueryBuilder(String fieldName, TermsLookup termsLookup) {
this.fieldName = fieldName;
this.values = values == null ? null : convert(values);
this.termsLookup = termsLookup;
this.rewrite_override = rewrite_override;
this.supplier = null;
}

Expand Down Expand Up @@ -425,18 +426,13 @@ public static TermsQueryBuilder fromXContent(XContentParser parser) throws IOExc
}
fieldName = currentFieldName;
termsLookup = TermsLookup.parseTermsLookup(parser);
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) {
rewrite_override = parser.textOrNull();
}
}
} else if (token.isValue()) {
if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
boost = parser.floatValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
queryName = parser.text();
} else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) {
rewrite_override = parser.textOrNull();
} else {
throw new ParsingException(
parser.getTokenLocation(),
Expand Down

0 comments on commit 2ce46c4

Please sign in to comment.