You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/05/26 22:39:58 UTC

svn commit: r1681853 - in /lucene/dev/branches/LUCENE-6481/lucene/sandbox/src: java/org/apache/lucene/search/GeoPointInPolygonQuery.java test/org/apache/lucene/search/TestGeoPointQuery.java

Author: mikemccand
Date: Tue May 26 20:39:58 2015
New Revision: 1681853

URL: http://svn.apache.org/r1681853
Log:
LUCENE-6481: add back lost GeoPointInPolygonQuery.isWithin override

Modified:
    lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInPolygonQuery.java
    lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/test/org/apache/lucene/search/TestGeoPointQuery.java

Modified: lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInPolygonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInPolygonQuery.java?rev=1681853&r1=1681852&r2=1681853&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInPolygonQuery.java (original)
+++ lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInPolygonQuery.java Tue May 26 20:39:58 2015
@@ -83,6 +83,7 @@ public final class GeoPointInPolygonQuer
       throw new IllegalArgumentException("first and last points of the polygon must be the same (it must close itself): polyLons[0]=" + polyLons[0] + " polyLons[" + (polyLons.length-1) + "]=" + polyLons[polyLons.length-1]);
     }
 
+    // nocommit we should at least assert that bbox does in fact fully contain the poly?
     this.x = polyLons;
     this.y = polyLats;
   }
@@ -169,6 +170,11 @@ public final class GeoPointInPolygonQuer
       super(tenum);
     }
 
+    @Override
+    protected boolean isWithin(final double minLon, final double minLat, final double maxLon, final double maxLat) {
+      return GeoUtils.rectIsWithin(minLon, minLat, maxLon, maxLat, x, y);
+    }
+
     /**
      * The two-phase query approach. The parent
      * {@link org.apache.lucene.search.GeoPointInBBoxQuery.GeoBBoxTermsEnum#accept} method is called to match

Modified: lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/test/org/apache/lucene/search/TestGeoPointQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/test/org/apache/lucene/search/TestGeoPointQuery.java?rev=1681853&r1=1681852&r2=1681853&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/test/org/apache/lucene/search/TestGeoPointQuery.java (original)
+++ lucene/dev/branches/LUCENE-6481/lucene/sandbox/src/test/org/apache/lucene/search/TestGeoPointQuery.java Tue May 26 20:39:58 2015
@@ -306,7 +306,7 @@ public class TestGeoPointQuery extends L
               if (random().nextBoolean()) {
                 query = new GeoPointInBBoxQuery(FIELD_NAME, lon0, lat0, lon1, lat1);
               } else {
-                // nocommit remove "false &&" below
+                // nocommit why does test fail if we enable this?  it should pass?
                 if (false && random().nextBoolean()) {
                   // Intentionally pass a "too big" bounding box:
                   double pct = random().nextDouble()*0.5;