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.
This commit is contained in:
Nicholas Knize 2015-11-16 14:45:02 -06:00
parent e4cc94c11e
commit 7f5da1d6a3
1 changed files with 4 additions and 4 deletions

View File

@ -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();