Apache Lucene open-source search software
LUCENE-8454: Fix tessellator to use original polygon vertices.
Nicholas Knized7e97fb7f84d
diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.javaindex a03e57cf3d2..9a63ad27a88 100644--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java@@ -800,12 +800,12 @@ final public class Tessellator {/** get the x value */public final double getX() {- return x;+ return polygon.getPolyLon(vrtxIdx);}/** get the y value */public final double getY() {- return y;+ return polygon.getPolyLat(vrtxIdx);}/** get the longitude value */diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.javaindex 9825e6a99ad..ce76a82c8dc 100644--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java@@ -99,10 +99,4 @@ public class TestLatLonPolygonShapeQueries extends BaseLatLonShapeTestCase {return queryRelation == QueryRelation.INTERSECTS ? false : true;}}-- @Override- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-8454")- public void testRandomMedium() throws Exception {- super.testRandomMedium();- }}diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.javaindex 2f6e5e19d85..9a125bacdae 100644--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java@@ -200,4 +200,27 @@ public class TestLatLonShape extends LuceneTestCase {IOUtils.close(reader, dir);}++ public void testLUCENE8454() throws Exception {+ Directory dir = newDirectory();+ RandomIndexWriter writer = new RandomIndexWriter(random(), dir);++ Polygon poly = new Polygon(new double[] {-1.490648725633769E-132d, 90d, 90d, -1.490648725633769E-132d},+ new double[] {0d, 0d, 180d, 0d});++ Document document = new Document();+ addPolygonsToDoc(FIELDNAME, document, poly);+ writer.addDocument(document);++ ///// search //////+ IndexReader reader = writer.getReader();+ writer.close();+ IndexSearcher searcher = newSearcher(reader);++ // search a bbox in the hole+ Query q = LatLonShape.newBoxQuery(FIELDNAME, QueryRelation.DISJOINT,-29.46555603761226d, 0.0d, 8.381903171539307E-8d, 0.9999999403953552d);+ assertEquals(0, searcher.count(q));++ IOUtils.close(reader, dir);+ }}