From 86f147fc0b564a94a47822c1359a476448e69311 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Mon, 16 Sep 2013 14:50:58 +0200 Subject: [PATCH] remove default scale for geo fields --- .../index/query/functionscore/DecayFunctionParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java b/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java index ab58886f7f8..7bf2ada66fd 100644 --- a/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java +++ b/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);