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:05 UTC
lucene-solr:branch_7x: 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_7x ca7d72a07 -> a14948388
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/a1494838
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a1494838
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a1494838
Branch: refs/heads/branch_7x
Commit: a14948388a3c0ff80392b41dad6dbf36f9272f22
Parents: ca7d72a
Author: Ignacio Vera <iv...@apache.org>
Authored: Tue Apr 3 10:20:43 2018 +0200
Committer: Ignacio Vera <iv...@apache.org>
Committed: Tue Apr 3 10:20:43 2018 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 5 +++++
.../apache/lucene/spatial3d/geom/GeoStandardCircle.java | 12 ++++++++++++
.../org/apache/lucene/spatial3d/geom/GeoCircleTest.java | 8 ++++++++
3 files changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a1494838/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 13ab3e7..49b366a 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -21,6 +21,11 @@ New Features
* LUCENE-8125: ICUTokenizer support for emoji/emoji sequence tokens. (Robert Muir)
+Bug Fixes
+
+* LUCENE-8234: Fixed bug in how spatial relationship is computed for
+ GeoStandardCircle when it covers the whole world. (Ignacio Vera)
+
Other
* LUCENE-8228: removed obsolete IndexDeletionPolicy clone() requirements from
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a1494838/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/a1494838/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);
+ }
}