New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CompletionFieldMapper to correctly parse weight #8197
Conversation
@@ -119,8 +119,9 @@ The following parameters are supported: | |||
might not yield any results, if `input` and `output` differ strongly). | |||
|
|||
`weight`:: | |||
A positive integer, which defines a weight and allows you to | |||
rank your suggestions. This field is optional. | |||
A positive integer or a string representing a positive integer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use "containing" instead of "representing"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
I left some comments. The main thing is I would simplify by separating the string/number case, since they really are different other than range checking of the value. |
@rjernst Thanks for the feedback, I have updated the PR accordingly. |
} catch (NumberFormatException e) { | ||
throw new ElasticsearchIllegalArgumentException("Weight must be a string representing a numeric value, but was [" + parser.text() + "]"); | ||
} | ||
weight = weightValue.longValue(); // always parse a long to make sure we don't get the overflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just "overflow" not "the overflow"?
LGTM, just one more minor comment. |
@rjernst Thanks! |
@areek you want to get this merged in? |
…ight - Allows weight to be defined as a string representation of a positive integer closes elastic#8090
Allows weight to be defined as a string representation of a positive integer
closes #8090