|
@@ -51,7 +51,7 @@ public class SearchIterator {
|
|
|
private int cacheId;
|
|
|
private boolean initSuccess;
|
|
|
private int returnedCount;
|
|
|
- private double width;
|
|
|
+ private float width;
|
|
|
private float tailBand;
|
|
|
|
|
|
private List<Object> filteredIds;
|
|
@@ -137,8 +137,8 @@ public class SearchIterator {
|
|
|
|
|
|
private void checkRmRangeSearchParameters() {
|
|
|
if (params.containsKey(RADIUS) && params.containsKey(RANGE_FILTER)) {
|
|
|
- float radius = (float) params.get(RADIUS);
|
|
|
- float rangeFilter = (float) params.get(RANGE_FILTER);
|
|
|
+ float radius = getFloatValue(RADIUS);
|
|
|
+ float rangeFilter = getFloatValue(RANGE_FILTER);
|
|
|
if (metricsPositiveRelated(metricType) && radius <= rangeFilter) {
|
|
|
String msg = String.format("for metrics:%s, radius must be larger than range_filter, please adjust your parameter", metricType);
|
|
|
ExceptionUtils.throwUnExpectedException(msg);
|
|
@@ -269,7 +269,7 @@ public class SearchIterator {
|
|
|
|
|
|
if (width == 0.0) {
|
|
|
// enable a minimum value for width to avoid radius and range_filter equal error
|
|
|
- width = 0.05;
|
|
|
+ width = 0.05f;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -357,16 +357,16 @@ public class SearchIterator {
|
|
|
});
|
|
|
|
|
|
if (metricsPositiveRelated(metricType)) {
|
|
|
- double nextRadius = tailBand + width * coefficient;
|
|
|
- if (params.containsKey(RADIUS) && nextRadius > (double) params.get(RADIUS)) {
|
|
|
- nextParams.put(RADIUS, params.get(RADIUS));
|
|
|
+ float nextRadius = tailBand + width * coefficient;
|
|
|
+ if (params.containsKey(RADIUS) && nextRadius > getFloatValue(RADIUS)) {
|
|
|
+ nextParams.put(RADIUS, getFloatValue(RADIUS));
|
|
|
} else {
|
|
|
nextParams.put(RADIUS, nextRadius);
|
|
|
}
|
|
|
} else {
|
|
|
double nextRadius = tailBand - width * coefficient;
|
|
|
- if (params.containsKey(RADIUS) && nextRadius < (double) params.get(RADIUS)) {
|
|
|
- nextParams.put(RADIUS, params.get(RADIUS));
|
|
|
+ if (params.containsKey(RADIUS) && nextRadius < getFloatValue(RADIUS)) {
|
|
|
+ nextParams.put(RADIUS, getFloatValue(RADIUS));
|
|
|
} else {
|
|
|
nextParams.put(RADIUS, nextRadius);
|
|
|
}
|
|
@@ -428,4 +428,8 @@ public class SearchIterator {
|
|
|
DecimalFormat df = new DecimalFormat("0.0");
|
|
|
return df.format(value);
|
|
|
}
|
|
|
+
|
|
|
+ private float getFloatValue(String key) {
|
|
|
+ return ((Double) params.get(key)).floatValue();
|
|
|
+ }
|
|
|
}
|