diff --git a/src/java/org/apache/solr/search/function/distance/DistanceUtils.java b/src/java/org/apache/solr/search/function/distance/DistanceUtils.java index a57744b40f3..359bf6b74d8 100644 --- a/src/java/org/apache/solr/search/function/distance/DistanceUtils.java +++ b/src/java/org/apache/solr/search/function/distance/DistanceUtils.java @@ -140,8 +140,9 @@ public class DistanceUtils { while (start < end && externalVal.charAt(start) == ' ') start++; while (end > start && externalVal.charAt(end - 1) == ' ') end--; out[i] = externalVal.substring(start, end); - start = end + 1; + start = idx + 1; end = externalVal.indexOf(',', start); + idx = end; if (end == -1) { end = externalVal.length(); } @@ -180,8 +181,9 @@ public class DistanceUtils { while (start < end && externalVal.charAt(start) == ' ') start++; while (end > start && externalVal.charAt(end - 1) == ' ') end--; out[i] = Double.parseDouble(externalVal.substring(start, end)); - start = end + 1; + start = idx + 1; end = externalVal.indexOf(',', start); + idex = end; if (end == -1) { end = externalVal.length(); }