Skip to content

Commit

Permalink
Geo: Improved error handling in geo_distance
Browse files Browse the repository at this point in the history
geo_distance filter now throws a parse exception if no distance parameter is supplied

Close #7260
  • Loading branch information
colings86 committed Aug 14, 2014
1 parent 6023a3a commit 7602b13
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -141,7 +141,9 @@ public Filter parse(QueryParseContext parseContext) throws IOException, QueryPar
}
}

if (vDistance instanceof Number) {
if (vDistance == null) {
throw new QueryParsingException(parseContext.index(), "geo_distance requires 'distance' to be specified");
} else if (vDistance instanceof Number) {
distance = DistanceUnit.DEFAULT.convert(((Number) vDistance).doubleValue(), unit);
} else {
distance = DistanceUnit.parse((String) vDistance, unit, DistanceUnit.DEFAULT);
Expand Down

0 comments on commit 7602b13

Please sign in to comment.