mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
don't use substraction for comparison if datatypes can overflow
This commit is contained in:
parent
f97021b165
commit
033d6e4306
@ -105,7 +105,13 @@ public class GeoDistanceComparator extends FieldComparator<Double> {
|
||||
} else {
|
||||
distance1 = fixedSourceDistance.calculate(geoPoint.lat(), geoPoint.lon());
|
||||
}
|
||||
return (int) (distance1 - distance2);
|
||||
if (distance1 < distance2) {
|
||||
return -1;
|
||||
} else if (distance1 == distance2) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user