From 8f5ef078b0af8db1998f5a04a772129fdd5c9f6e Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 12 Apr 2016 09:27:30 -0400 Subject: [PATCH] LUCENE-7207: fix test bug. shrinking a box which is a line can create a cross-dateline query! --- .../org/apache/lucene/spatial/util/BaseGeoPointTestCase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java b/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java index c2536bd47a3..8daf83f8105 100644 --- a/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java +++ b/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java @@ -1271,7 +1271,9 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase { } // now shrink 1 ulp in each direction if possible: it should not include bogus stuff - if (rect.minLat != 90 && rect.maxLat != -90 && rect.minLon != 80 && rect.maxLon != -180) { + // we can't shrink if values are already at extremes, and + // we can't do this if rectangle is actually a line or we will create a cross-dateline query + if (rect.minLat != 90 && rect.maxLat != -90 && rect.minLon != 80 && rect.maxLon != -180 && rect.minLon != rect.maxLon) { // note we put points on "sides" not just "corners" so we just shrink all 4 at once for now: it should exclude all points! assertEquals(0, s.count(newRectQuery(FIELD_NAME, Math.nextUp(rect.minLat), Math.nextDown(rect.maxLat),