فهرست منبع

remove default scale for geo fields

Britta Weber 12 سال پیش
والد
کامیت
86f147fc0b
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java

+ 3 - 3
src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java

@@ -197,7 +197,7 @@ public abstract class DecayFunctionParser implements ScoreFunctionParser {
         XContentParser.Token token;
         String parameterName = null;
         GeoPoint origin = new GeoPoint();
-        String scaleString = "1km";
+        String scaleString = null;
         String offsetString = "0km";
         double decay = 0.5;
         while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
@@ -215,8 +215,8 @@ public abstract class DecayFunctionParser implements ScoreFunctionParser {
                 throw new ElasticSearchParseException("Parameter " + parameterName + " not supported!");
             }
         }
-        if (origin == null) {
-            throw new ElasticSearchParseException(DecayFunctionBuilder.ORIGIN + "must be set for geo fields.");
+        if (origin == null || scaleString == null) {
+            throw new ElasticSearchParseException(DecayFunctionBuilder.ORIGIN + " and " + DecayFunctionBuilder.SCALE + " must be set for geo fields.");
         }
         double scale = DistanceUnit.parse(scaleString, DistanceUnit.METERS, DistanceUnit.METERS);
         double offset = DistanceUnit.parse(offsetString, DistanceUnit.METERS, DistanceUnit.METERS);