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
Allow to parse lat/lon as strings and coerce them #5626
Allow to parse lat/lon as strings and coerce them #5626
Conversation
Also needs to be fixed here:
|
updated, can you check again? |
if(parser.nextToken() == Token.VALUE_NUMBER) { | ||
lat = parser.doubleValue(); | ||
parser.nextToken(); | ||
if(parser.currentToken() == Token.VALUE_NUMBER || parser.currentToken() == Token.VALUE_STRING) { |
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 you want to use a swich here?
Tests now passing ++ |
I think we could also remove the duplicated code here. The reason it exists is to support these two formats in the query POST services/_suggest
{
"suggest" : {
"text" : "m",
"completion" : {
"field" : "suggest_field",
"size": 10,
"context": {
"location": {
"value": {
"lat": 0,
"lon": 0
},
"precision": "1km"
}
}
}
}
} POST services/_suggest
{
"suggest" : {
"text" : "m",
"completion" : {
"field" : "suggest_field",
"size": 10,
"context": {
"location": {
"lat": 0,
"lon": 0,
"precision": "1km"
}
}
}
}
} If we only want to support the first format, we could remove the duplicate geo point parsing... the second one is shorter and more handy through |
updated the PR to use a switch statement |
LGTM |
In order to be more failsafe parsing GeoPoints can support lat/lon as strings and coerce them. Added support and test for this.
seems like we have to backport this to 1.0 branch as well @spinscale should we? |
+1, will do |
In order to be more failsafe parsing GeoPoints can support lat/lon as strings and coerce them. Added support and test for this. This is a part of the patch of 8b8cd26 from PR elastic#5626
In order to be more failsafe parsing GeoPoints can support lat/lon as strings and coerce them. Added support and test for this. This is a part of the patch of 8b8cd26 from PR elastic#5626
In order to be more failsafe parsing GeoPoints can support
lat/lon as strings and coerce them. Added support and test for this.