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 2017/09/10 11:00:47 UTC

[1/2] lucene-solr:branch_7x: LUCENE-7955: Adjust degenerate path logic to not consider endpoints unless needed.

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x c9af28ff8 -> a67984552


LUCENE-7955: Adjust degenerate path logic to not consider endpoints unless needed.


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

Branch: refs/heads/branch_7x
Commit: 4b34c0b9d1a2e7495c7ae568c2472f10f1096504
Parents: a1c584d
Author: Karl Wright <Da...@gmail.com>
Authored: Sun Sep 10 07:00:20 2017 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sun Sep 10 07:00:20 2017 -0400

----------------------------------------------------------------------
 .../spatial3d/geom/GeoDegeneratePath.java       | 21 ++++++++++----------
 .../geom/SimpleGeoPolygonRelationshipsTest.java | 15 ++++++++++++++
 2 files changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4b34c0b9/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java
index 175ca33..eaceb26 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java
@@ -259,10 +259,11 @@ class GeoDegeneratePath extends GeoBasePath {
     // Well, sort of.  We can detect intersections also due to overlap of segments with each other.
     // But that's an edge case and we won't be optimizing for it.
     //System.err.println(" Looking for intersection of plane "+plane+" with path "+this);
-    for (final SegmentEndpoint pathPoint : endPoints) {
-      if (pathPoint.intersects(planetModel, plane, notablePoints, bounds)) {
-        return true;
-      }
+    
+    // Since the endpoints are included in the path segments, we only need to do this if there are
+    // no path segments
+    if (endPoints.size() == 1) {
+      return endPoints.get(0).intersects(planetModel, plane, notablePoints, bounds);
     }
 
     for (final PathSegment pathSegment : segments) {
@@ -276,10 +277,10 @@ class GeoDegeneratePath extends GeoBasePath {
 
   @Override
   public boolean intersects(GeoShape geoShape) {
-    for (final SegmentEndpoint pathPoint : endPoints) {
-      if (pathPoint.intersects(geoShape)) {
-        return true;
-      }
+    // Since the endpoints are included in the path segments, we only need to do this if there are
+    // no path segments
+    if (endPoints.size() == 1) {
+      return endPoints.get(0).intersects(geoShape);
     }
 
     for (final PathSegment pathSegment : segments) {
@@ -300,8 +301,8 @@ class GeoDegeneratePath extends GeoBasePath {
     for (PathSegment pathSegment : segments) {
       pathSegment.getBounds(planetModel, bounds);
     }
-    for (SegmentEndpoint pathPoint : endPoints) {
-      pathPoint.getBounds(planetModel, bounds);
+    if (endPoints.size() == 1) {
+      endPoints.get(0).getBounds(planetModel, bounds);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4b34c0b9/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
index 06aa8b9..2589a19 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
@@ -736,6 +736,21 @@ public class SimpleGeoPolygonRelationshipsTest {
     assertEquals(GeoArea.CONTAINS,  rel);
   }
 
+  @Test
+  public void testDegeneratePathShape(){
+    GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, 0, 0);
+    GeoPoint point2 = new GeoPoint(PlanetModel.SPHERE, 0, 1);
+    GeoPoint[] pointPath1 = new GeoPoint[] {point1, point2};
+    GeoPath path1 = GeoPathFactory.makeGeoPath(PlanetModel.SPHERE, 0, pointPath1);
+    GeoPath path2 = GeoPathFactory.makeGeoPath(PlanetModel.SPHERE, 1, pointPath1);
+    int rel = path1.getRelationship(path2);
+    //if an end point is inside the shape it will always return intersects
+    assertEquals(GeoArea.CONTAINS, rel); //should be contains?
+    rel = path2.getRelationship(path1);
+    assertEquals(GeoArea.WITHIN, rel);
+  }
+
+
   private GeoPolygon buildConvexGeoPolygon(double lon1, double lat1,
                                            double lon2, double lat2,
                                            double lon3, double lat3,


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

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


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

Branch: refs/heads/branch_7x
Commit: a679845523c10f6972d3b2e89146566722aa1f54
Parents: 4b34c0b c9af28f
Author: Karl Wright <Da...@gmail.com>
Authored: Sun Sep 10 07:00:38 2017 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sun Sep 10 07:00:38 2017 -0400

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |  4 ++
 .../lucene/store/NativeFSLockFactory.java       | 14 ++++++-
 .../lucene/store/TestNativeFSLockFactory.java   | 42 ++++++++++++++++++++
 .../solrj/io/eval/CopyOfRangeEvaluator.java     |  4 +-
 .../solrj/io/stream/StreamExpressionTest.java   | 11 ++++-
 5 files changed, 71 insertions(+), 4 deletions(-)
----------------------------------------------------------------------