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

lucene-solr:branch_6x: LUCENE-8234: Fixed bug in how spatial relationship is computed for GeoStandardCircle when it covers the whole world

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x c34e92b94 -> 99e0694ed


LUCENE-8234: Fixed bug in how spatial relationship is computed for GeoStandardCircle when it covers the whole world


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

Branch: refs/heads/branch_6x
Commit: 99e0694edaecc0df75bb0d6c2379556816b42275
Parents: c34e92b
Author: Ignacio Vera <iv...@apache.org>
Authored: Tue Apr 3 10:22:07 2018 +0200
Committer: Ignacio Vera <iv...@apache.org>
Committed: Tue Apr 3 10:22:07 2018 +0200

----------------------------------------------------------------------
 lucene/CHANGES.txt                                      |  3 +++
 .../apache/lucene/spatial3d/geom/GeoStandardCircle.java | 12 ++++++++++++
 .../org/apache/lucene/spatial3d/geom/GeoCircleTest.java |  8 ++++++++
 3 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/99e0694e/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9565e22..d0e2e8a 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -43,6 +43,9 @@ New Features
 
 Bug Fixes
 
+* LUCENE-8234: Fixed bug in how spatial relationship is computed for
+  GeoStandardCircle when it covers the whole world. (Ignacio Vera)
+
 * LUCENE-8076: Normalize Vincenti distance calculation for planet models that aren't normalized.
   (Ignacio Vera)
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/99e0694e/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardCircle.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardCircle.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardCircle.java
index 7ac45932..a3c0d89 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardCircle.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardCircle.java
@@ -173,6 +173,18 @@ class GeoStandardCircle extends GeoBaseCircle {
   }
 
   @Override
+  public int getRelationship(GeoShape geoShape) {
+    if (circlePlane == null) {
+      //same as GeoWorld
+      if (geoShape.getEdgePoints().length > 0) {
+        return WITHIN;
+      }
+      return OVERLAPS;
+    }
+    return super.getRelationship(geoShape);
+  }
+
+  @Override
   public void getBounds(Bounds bounds) {
     super.getBounds(bounds);
     if (circlePlane == null) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/99e0694e/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
index 95d2a4c..2e49022 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
@@ -418,4 +418,12 @@ public class GeoCircleTest extends LuceneTestCase {
     assert gc.isWithin(gp)?solid.isWithin(gp):true;
     
   }
+
+  @Test
+  public void testWholeWorld() {
+    final GeoCircle circle1 = GeoCircleFactory.makeGeoCircle(PlanetModel.SPHERE, 0.0, 0.0, 3.1415926535897913);
+    final GeoCircle circle2 = GeoCircleFactory.makeGeoCircle(PlanetModel.SPHERE, Math.PI * 0.5, Math.PI, 3.141592653589792);
+
+    assertTrue(circle1.getRelationship(circle2) == GeoArea.OVERLAPS);
+  }
 }