lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject [04/50] [abbrv] lucene-solr:jira/solr-11990: LUCENE-8418: Mute LatLonShape polygonWithHole test until fix is applied
Date Sat, 28 Jul 2018 04:49:27 GMT
LUCENE-8418: Mute LatLonShape polygonWithHole test until fix is applied


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

Branch: refs/heads/jira/solr-11990
Commit: 509561bf2a9effe4fce19551c9ec037975cf9c02
Parents: 20a7ee9
Author: Nicholas Knize <nknize@gmail.com>
Authored: Fri Jul 20 11:18:58 2018 -0500
Committer: Nicholas Knize <nknize@gmail.com>
Committed: Fri Jul 20 11:36:47 2018 -0500

----------------------------------------------------------------------
 .../apache/lucene/document/TestLatLonShape.java | 37 ++++++++++++++------
 1 file changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/509561bf/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 d0a4b32..ac11e1b 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonShape.java
@@ -81,21 +81,12 @@ public class TestLatLonShape extends LuceneTestCase {
     Directory dir = newDirectory();
     RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
 
-    // add a random polygon without a hole
+    // add a random polygon
     Polygon p = GeoTestUtil.createRegularPolygon(0, 90, atLeast(1000000), numVertices);
     Document document = new Document();
     addPolygonsToDoc(FIELDNAME, document, p);
     writer.addDocument(document);
 
-    // add a random polygon with a hole
-    Polygon inner = new Polygon(new double[] {-1d, -1d, 1d, 1d, -1d},
-        new double[] {-91d, -89d, -89d, -91.0, -91.0});
-    Polygon outer = GeoTestUtil.createRegularPolygon(0, -90, atLeast(1000000), numVertices);
-
-    document = new Document();
-    addPolygonsToDoc(FIELDNAME, document, new Polygon(outer.getPolyLats(), outer.getPolyLons(),
inner));
-    writer.addDocument(document);
-
     ////// search /////
     // search an intersecting bbox
     IndexReader reader = writer.getReader();
@@ -108,8 +99,32 @@ public class TestLatLonShape extends LuceneTestCase {
     q = newRectQuery(FIELDNAME, p.minLat-1d, p.minLat+1, p.minLon-1d, p.minLon+1d);
     assertEquals(0, searcher.count(q));
 
+    IOUtils.close(reader, dir);
+  }
+
+  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-8418")
+  /** test random polygons with a single hole */
+  public void testPolygonWithHole() throws Exception {
+    int numVertices = TestUtil.nextInt(random(), 50, 100);
+    Directory dir = newDirectory();
+    RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
+
+    // add a random polygon with a hole
+    Polygon inner = new Polygon(new double[] {-1d, -1d, 1d, 1d, -1d},
+        new double[] {-91d, -89d, -89d, -91.0, -91.0});
+    Polygon outer = GeoTestUtil.createRegularPolygon(0, -90, atLeast(1000000), numVertices);
+
+    Document document = new Document();
+    addPolygonsToDoc(FIELDNAME, document, new Polygon(outer.getPolyLats(), outer.getPolyLons(),
inner));
+    writer.addDocument(document);
+
+    ///// search //////
+    IndexReader reader = writer.getReader();
+    writer.close();
+    IndexSearcher searcher = newSearcher(reader);
+
     // search a bbox in the hole
-    q = newRectQuery(FIELDNAME, inner.minLat + 1e-6, inner.maxLat - 1e-6, inner.minLon +
1e-6, inner.maxLon - 1e-6);
+    Query q = newRectQuery(FIELDNAME, inner.minLat + 1e-6, inner.maxLat - 1e-6, inner.minLon
+ 1e-6, inner.maxLon - 1e-6);
     assertEquals(0, searcher.count(q));
 
     IOUtils.close(reader, dir);


Mime
View raw message