add a check for at least one range

This commit is contained in:
kimchy 2010-08-01 17:05:06 +03:00
parent c08791f816
commit c5811eb060
1 changed files with 4 additions and 0 deletions

View File

@ -155,6 +155,10 @@ public class GeoDistanceFacetCollectorParser implements FacetCollectorParser {
throw new FacetPhaseExecutionException(facetName, "lat/lon not set for geo_distance facet");
}
if (entries.isEmpty()) {
throw new FacetPhaseExecutionException(facetName, "no ranges defined for geo_distance facet");
}
if (valueFieldName != null) {
return new ValueGeoDistanceFacetCollector(facetName, fieldName, lat, lon, unit, geoDistance, entries.toArray(new GeoDistanceFacet.Entry[entries.size()]),
context.fieldDataCache(), context.mapperService(), valueFieldName);