Bladeren bron

Fix reproducible GeoDistanceRangeQueryTests.testToQuery error

This issue occurs if the center latitude of the GeoPointDistance query is set to one of the poles. Since this issue is set to be fixed in LUCENE-6897 this commit temporarily limits the random latitudinal location to not include the poles.
Nicholas Knize 10 jaren geleden
bovenliggende
commit
7f5da1d6a3
1 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 4 4
      core/src/test/java/org/elasticsearch/index/query/GeoDistanceRangeQueryTests.java

+ 4 - 4
core/src/test/java/org/elasticsearch/index/query/GeoDistanceRangeQueryTests.java

@@ -44,14 +44,14 @@ public class GeoDistanceRangeQueryTests extends AbstractQueryTestCase<GeoDistanc
     protected GeoDistanceRangeQueryBuilder doCreateTestQueryBuilder() {
         Version version = queryShardContext().indexVersionCreated();
         GeoDistanceRangeQueryBuilder builder;
+        GeoPoint randomPoint = RandomGeoGenerator.randomPointIn(random(), -180.0, -89.9, 180.0, 89.9);
         if (randomBoolean()) {
-            builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, randomGeohash(3, 12));
+            builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, randomPoint.geohash());
         } else {
-            GeoPoint point = RandomGeoGenerator.randomPoint(random());
             if (randomBoolean()) {
-                builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, point);
+                builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, randomPoint);
             } else {
-                builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, point.lat(), point.lon());
+                builder = new GeoDistanceRangeQueryBuilder(GEO_POINT_FIELD_NAME, randomPoint.lat(), randomPoint.lon());
             }
         }
         GeoPoint point = builder.point();