You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2018/05/30 01:03:59 UTC

[1/2] lucene-solr:master: LUCENE-8337: Fix problems with how travel planes too close to edge of world are disallowed, and increase the size of the disallowed window by an order of magnitude.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 6e0da7e2f -> 376440635


LUCENE-8337: Fix problems with how travel planes too close to edge of world are disallowed, and increase the size of the disallowed window by an order of magnitude.


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

Branch: refs/heads/master
Commit: ceb4f768bf5b71a91872f9ecdc5ebed4d0262903
Parents: 7ce6dbd
Author: Karl Wright <Da...@gmail.com>
Authored: Tue May 29 21:03:03 2018 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue May 29 21:03:03 2018 -0400

----------------------------------------------------------------------
 .../spatial3d/geom/GeoComplexPolygon.java       | 50 ++++++++++++--------
 .../lucene/spatial3d/geom/GeoPolygonTest.java   |  4 +-
 2 files changed, 34 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ceb4f768/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index 25e1d67..64f8f87 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -74,7 +74,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
   private final GeoPoint[] edgePoints;
   private final Edge[] shapeStartEdges;
   
-  private final static double NEAR_EDGE_CUTOFF = -Vector.MINIMUM_RESOLUTION * 1000.0;
+  private final static double NEAR_EDGE_CUTOFF = -Vector.MINIMUM_RESOLUTION * 10000.0;
   
   /**
    * Create a complex polygon from multiple lists of points, and a single point which is known to be in or out of
@@ -143,37 +143,40 @@ class GeoComplexPolygon extends GeoBasePolygon {
     this.testPoint1FixedZPlane = new Plane(0.0, 0.0, 1.0, -testPoint1.z);
     
     Plane testPoint1FixedYAbovePlane = new Plane(testPoint1FixedYPlane, true);
-    if (testPoint1FixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() - testPoint1FixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    
+    // We compare the plane's Y value (etc), which is -D, with the planet's maximum and minimum Y poles.
+    
+    if (-testPoint1FixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() + testPoint1FixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedYAbovePlane = null;
     }
     this.testPoint1FixedYAbovePlane = testPoint1FixedYAbovePlane;
     
     Plane testPoint1FixedYBelowPlane = new Plane(testPoint1FixedYPlane, false);
-    if (testPoint1FixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF ||  planetModel.getMinimumYValue() - testPoint1FixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint1FixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF ||  planetModel.getMinimumYValue() + testPoint1FixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedYBelowPlane = null;
     }
     this.testPoint1FixedYBelowPlane = testPoint1FixedYBelowPlane;
     
     Plane testPoint1FixedXAbovePlane = new Plane(testPoint1FixedXPlane, true);
-    if (testPoint1FixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - testPoint1FixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint1FixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + testPoint1FixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedXAbovePlane = null;
     }
     this.testPoint1FixedXAbovePlane = testPoint1FixedXAbovePlane;
     
     Plane testPoint1FixedXBelowPlane = new Plane(testPoint1FixedXPlane, false);
-    if (testPoint1FixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - testPoint1FixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint1FixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + testPoint1FixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedXBelowPlane = null;
     }
     this.testPoint1FixedXBelowPlane = testPoint1FixedXBelowPlane;
     
     Plane testPoint1FixedZAbovePlane = new Plane(testPoint1FixedZPlane, true);
-    if (testPoint1FixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF ||planetModel.getMinimumZValue() - testPoint1FixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint1FixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF ||planetModel.getMinimumZValue() + testPoint1FixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedZAbovePlane = null;
     }
     this.testPoint1FixedZAbovePlane = testPoint1FixedZAbovePlane;
     
     Plane testPoint1FixedZBelowPlane = new Plane(testPoint1FixedZPlane, false);
-    if (testPoint1FixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() - testPoint1FixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint1FixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() + testPoint1FixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint1FixedZBelowPlane = null;
     }
     this.testPoint1FixedZBelowPlane = testPoint1FixedZBelowPlane;
@@ -184,37 +187,37 @@ class GeoComplexPolygon extends GeoBasePolygon {
     this.testPoint2FixedZPlane = new Plane(0.0, 0.0, 1.0, -testPoint2.z);
     
     Plane testPoint2FixedYAbovePlane = new Plane(testPoint2FixedYPlane, true);
-    if (testPoint2FixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() - testPoint2FixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() + testPoint2FixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedYAbovePlane = null;
     }
     this.testPoint2FixedYAbovePlane = testPoint2FixedYAbovePlane;
     
     Plane testPoint2FixedYBelowPlane = new Plane(testPoint2FixedYPlane, false);
-    if (testPoint2FixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF ||  planetModel.getMinimumYValue() - testPoint2FixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF ||  planetModel.getMinimumYValue() + testPoint2FixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedYBelowPlane = null;
     }
     this.testPoint2FixedYBelowPlane = testPoint2FixedYBelowPlane;
     
     Plane testPoint2FixedXAbovePlane = new Plane(testPoint2FixedXPlane, true);
-    if (testPoint2FixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - testPoint2FixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + testPoint2FixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedXAbovePlane = null;
     }
     this.testPoint2FixedXAbovePlane = testPoint2FixedXAbovePlane;
     
     Plane testPoint2FixedXBelowPlane = new Plane(testPoint2FixedXPlane, false);
-    if (testPoint2FixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - testPoint2FixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + testPoint2FixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedXBelowPlane = null;
     }
     this.testPoint2FixedXBelowPlane = testPoint2FixedXBelowPlane;
     
     Plane testPoint2FixedZAbovePlane = new Plane(testPoint2FixedZPlane, true);
-    if (testPoint2FixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF ||planetModel.getMinimumZValue() - testPoint2FixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF ||planetModel.getMinimumZValue() + testPoint2FixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedZAbovePlane = null;
     }
     this.testPoint2FixedZAbovePlane = testPoint2FixedZAbovePlane;
     
     Plane testPoint2FixedZBelowPlane = new Plane(testPoint2FixedZPlane, false);
-    if (testPoint2FixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() - testPoint2FixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
+    if (-testPoint2FixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() + testPoint2FixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
         testPoint2FixedZBelowPlane = null;
     }
     this.testPoint2FixedZBelowPlane = testPoint2FixedZBelowPlane;
@@ -352,32 +355,32 @@ class GeoComplexPolygon extends GeoBasePolygon {
       final Plane travelPlaneFixedZ = new Plane(0.0, 0.0, 1.0, -z);
 
       Plane fixedYAbovePlane = new Plane(travelPlaneFixedY, true);
-      if (fixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() - fixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedYAbovePlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() + fixedYAbovePlane.D > NEAR_EDGE_CUTOFF) {
           fixedYAbovePlane = null;
       }
       
       Plane fixedYBelowPlane = new Plane(travelPlaneFixedY, false);
-      if (fixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() - fixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedYBelowPlane.D - planetModel.getMaximumYValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumYValue() + fixedYBelowPlane.D > NEAR_EDGE_CUTOFF) {
           fixedYBelowPlane = null;
       }
       
       Plane fixedXAbovePlane = new Plane(travelPlaneFixedX, true);
-      if (fixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - fixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedXAbovePlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + fixedXAbovePlane.D > NEAR_EDGE_CUTOFF) {
           fixedXAbovePlane = null;
       }
       
       Plane fixedXBelowPlane = new Plane(travelPlaneFixedX, false);
-      if (fixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() - fixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedXBelowPlane.D - planetModel.getMaximumXValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumXValue() + fixedXBelowPlane.D > NEAR_EDGE_CUTOFF) {
           fixedXBelowPlane = null;
       }
       
       Plane fixedZAbovePlane = new Plane(travelPlaneFixedZ, true);
-      if (fixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() - fixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedZAbovePlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() + fixedZAbovePlane.D > NEAR_EDGE_CUTOFF) {
           fixedZAbovePlane = null;
       }
       
       Plane fixedZBelowPlane = new Plane(travelPlaneFixedZ, false);
-      if (fixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() - fixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
+      if (-fixedZBelowPlane.D - planetModel.getMaximumZValue() > NEAR_EDGE_CUTOFF || planetModel.getMinimumZValue() + fixedZBelowPlane.D > NEAR_EDGE_CUTOFF) {
           fixedZBelowPlane = null;
       }
 
@@ -669,9 +672,11 @@ class GeoComplexPolygon extends GeoBasePolygon {
     //return new SectorLinearCrossingEdgeIterator(plane, abovePlane, belowPlane, thePointX, thePointY, thePointZ);
     //
     try {
+      //System.out.println(" creating sector linear crossing edge iterator");
       return new SectorLinearCrossingEdgeIterator(testPoint, plane, abovePlane, belowPlane, thePointX, thePointY, thePointZ);
     } catch (IllegalArgumentException e) {
       // Assume we failed because we could not construct bounding planes, so do it another way.
+      //System.out.println(" create full linear crossing edge iterator");
       return new FullLinearCrossingEdgeIterator(testPoint, plane, abovePlane, belowPlane, thePointX, thePointY, thePointZ);
     }
   }
@@ -787,6 +792,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
         return rval;
       } catch (IllegalArgumentException e) {
         // Intersection point apparently was on edge, so try another strategy
+        //System.out.println(" Trying dual crossing edge iterator");
         final CountingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(testPoint,
           firstLegPlane, firstLegAbovePlane, firstLegBelowPlane,
           secondLegPlane, secondLegAbovePlane, secondLegBelowPlane,
@@ -1397,12 +1403,17 @@ class GeoComplexPolygon extends GeoBasePolygon {
     private boolean edgeCrossesEnvelope(final Plane edgePlane, final GeoPoint intersectionPoint, final Plane envelopePlane) {
       final GeoPoint[] adjoiningPoints = findAdjoiningPoints(edgePlane, intersectionPoint, envelopePlane);
       if (adjoiningPoints == null) {
+        //System.out.println("    No adjoining points");
         return true;
       }
       int withinCount = 0;
       for (final GeoPoint adjoining : adjoiningPoints) {
+        //System.out.println("    Adjoining point "+adjoining);
         if (plane.evaluateIsZero(adjoining) && bound1.isWithin(adjoining) && bound2.isWithin(adjoining)) {
+          //System.out.println("     within!!");
           withinCount++;
+        } else {
+          //System.out.println("     evaluateIsZero? "+plane.evaluateIsZero(adjoining)+" bound1.isWithin? "+bound1.isWithin(adjoining)+" bound2.isWithin? "+bound2.isWithin(adjoining));
         }
       }
       return (withinCount & 1) != 0;
@@ -1834,6 +1845,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
       // Loop back around and use a bigger delta
     }
     // Had to abort, so return null.
+    //System.out.println("     Adjoining points not found.  Are planes parallel?  edge = "+plane+"; envelope = "+envelopePlane+"; perpendicular = "+perpendicular);
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ceb4f768/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
index a2a4e85..d301de1 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
@@ -1817,7 +1817,7 @@ shape:
   }
   
   @Test
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8337")  
+  //@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8337")  
   public void testLUCENE8337() {
     /*
    {planetmodel=PlanetModel.WGS84, number of shapes=1, address=c865f21d, 
@@ -1844,6 +1844,8 @@ shape:
     
     final GeoPoint thePoint = new GeoPoint(PlanetModel.WGS84, -6.499661194605612E-10, -2.0286460544410216);
     
+    System.out.println("large inset: "+largePolygon.isWithin(thePoint));
+    
     assertTrue(largePolygon.isWithin(thePoint) == smallPolygon.isWithin(thePoint));
     
   }


[2/2] lucene-solr:master: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr

Posted by kw...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr


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

Branch: refs/heads/master
Commit: 3764406352d7739adc3c7720b4d49e2f0214590d
Parents: ceb4f76 6e0da7e
Author: Karl Wright <Da...@gmail.com>
Authored: Tue May 29 21:03:43 2018 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue May 29 21:03:43 2018 -0400

----------------------------------------------------------------------
 .../clustering/ClusteringComponentTest.java     |  11 +-
 .../carrot2/CarrotClusteringEngineTest.java     |  16 +-
 .../src/java/org/apache/solr/core/SolrCore.java |  37 ++-
 .../apache/solr/handler/ReplicationHandler.java |  17 +-
 .../org/apache/solr/handler/SnapShooter.java    |   7 +-
 .../solr/handler/admin/CreateSnapshotOp.java    |   9 +-
 .../java/org/apache/solr/util/IOFunction.java   |  29 ++
 .../org/apache/solr/util/TestInjection.java     |  24 +-
 .../org/apache/solr/core/TestCodecSupport.java  |  23 +-
 .../test/org/apache/solr/core/TestNRTOpen.java  |  72 +++--
 .../solr/core/TestQuerySenderListener.java      |  45 ++--
 .../solr/core/TestQuerySenderNoQuery.java       |  25 +-
 .../apache/solr/core/TestSimpleTextCodec.java   |  10 +-
 .../admin/AutoscalingHistoryHandlerTest.java    |  33 ++-
 .../org/apache/solr/request/TestFaceting.java   |  12 +-
 .../solr/request/TestIntervalFaceting.java      |  13 +-
 .../org/apache/solr/schema/TestPointFields.java |  32 +--
 .../org/apache/solr/search/LargeFieldTest.java  |   9 +-
 .../org/apache/solr/search/TestLFUCache.java    |  31 +--
 .../apache/solr/search/TestNoOpRegenerator.java |  20 +-
 .../similarities/BaseSimilarityTestCase.java    |  16 +-
 .../spelling/DirectSolrSpellCheckerTest.java    |  33 ++-
 .../spelling/FileBasedSpellCheckerTest.java     | 112 ++++----
 .../spelling/IndexBasedSpellCheckerTest.java    | 263 +++++++++----------
 .../spelling/WordBreakSolrSpellCheckerTest.java |   1 +
 .../update/TestInPlaceUpdatesStandalone.java    |  16 +-
 26 files changed, 448 insertions(+), 468 deletions(-)
----------------------------------------------------------------------