Skip to content

Commit

Permalink
Make parsing strict for geo_shape query & filter and stricter for `…
Browse files Browse the repository at this point in the history
…common` query.

Closes #4508
  • Loading branch information
martijnvg committed Dec 18, 2013
1 parent bb4d3f5 commit e7e1667
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion rest-spec
Submodule rest-spec deleted from 2f5f78
1 change: 1 addition & 0 deletions rest-spec
Expand Up @@ -104,6 +104,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
}
}
}
} else {
throw new QueryParsingException(parseContext.index(), "[common] query does not support [" + currentFieldName + "]");
}
} else if (token.isValue()) {
if ("query".equals(currentFieldName)) {
Expand Down
Expand Up @@ -135,6 +135,8 @@ public Filter parse(QueryParseContext parseContext) throws IOException, QueryPar
throw new QueryParsingException(parseContext.index(), "Type for indexed shape not provided");
}
shape = fetchService.fetch(id, type, index, shapeFieldName);
} else {
throw new QueryParsingException(parseContext.index(), "[geo_shape] filter does not support [" + currentFieldName + "]");
}
}
}
Expand All @@ -145,6 +147,8 @@ public Filter parse(QueryParseContext parseContext) throws IOException, QueryPar
cache = parser.booleanValue();
} else if ("_cache_key".equals(currentFieldName)) {
cacheKey = new CacheKeyFilter.Key(parser.text());
} else {
throw new QueryParsingException(parseContext.index(), "[geo_shape] filter does not support [" + currentFieldName + "]");
}
}
}
Expand Down
Expand Up @@ -113,6 +113,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
throw new QueryParsingException(parseContext.index(), "Type for indexed shape not provided");
}
shape = fetchService.fetch(id, type, index, shapeFieldName);
} else {
throw new QueryParsingException(parseContext.index(), "[geo_shape] query does not support [" + currentFieldName + "]");
}
}
}
Expand All @@ -121,6 +123,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
boost = parser.floatValue();
} else if ("_name".equals(currentFieldName)) {
queryName = parser.text();
} else {
throw new QueryParsingException(parseContext.index(), "[geo_shape] query does not support [" + currentFieldName + "]");
}
}
}
Expand Down

0 comments on commit e7e1667

Please sign in to comment.