Skip to content

Commit

Permalink
Relax geopoint comparison tolerance
Browse files Browse the repository at this point in the history
Weighted centroid, morton hash, and geohash can be imprecise (computation error) to 1e-5. The previous compareTo set this tolerance too strict (1e-6) causing a reproducible comparison error on weighted centroid (#13558). This change relaxes the tolerance to the acceptable computation error of 1e-5

closes #13558
  • Loading branch information
nknize committed Sep 15, 2015
1 parent f62da59 commit 589fb96
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/apache/lucene/util/XGeoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class XGeoUtils {
public static final short BITS = 31;
private static final double LON_SCALE = (0x1L<<BITS)/360.0D;
private static final double LAT_SCALE = (0x1L<<BITS)/180.0D;
public static final double TOLERANCE = 1E-6;
public static final double TOLERANCE = 1E-5;

/** Minimum longitude value. */
public static final double MIN_LON_INCL = -180.0D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public void setupSuiteScopeCluster() throws Exception {


@Test
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/13558")
public void simple() throws Exception {
for (int precision = 1; precision <= XGeoHashUtils.PRECISION; precision++) {
SearchResponse response = client().prepareSearch("idx")
Expand Down

0 comments on commit 589fb96

Please sign in to comment.