You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/09/20 23:59:34 UTC

[28/29] lucene-solr:jira/http2: LUCENE-8454: Fix tessellator to use original polygon vertices.

LUCENE-8454: Fix tessellator to use original polygon vertices.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d7e97fb7
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d7e97fb7
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d7e97fb7

Branch: refs/heads/jira/http2
Commit: d7e97fb7f84d8613683a080610f177b7cae2b31a
Parents: 0dd7b70
Author: Nicholas Knize <nk...@gmail.com>
Authored: Thu Sep 20 10:39:24 2018 -0500
Committer: Nicholas Knize <nk...@gmail.com>
Committed: Thu Sep 20 10:39:24 2018 -0500

----------------------------------------------------------------------
 .../java/org/apache/lucene/geo/Tessellator.java |  4 ++--
 .../document/TestLatLonPolygonShapeQueries.java |  6 -----
 .../apache/lucene/document/TestLatLonShape.java | 23 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d7e97fb7/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java
index a03e57c..9a63ad2 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 */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d7e97fb7/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonPolygonShapeQueries.java
index 9825e6a..ce76a82 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();
-  }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d7e97fb7/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java
index 2f6e5e1..9a125ba 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);
+  }
 }