You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/03/22 03:48:00 UTC

lucene-solr:master: LUCENE-7125: remove additional confusion (we already quantize once, don't do it again).

Repository: lucene-solr
Updated Branches:
  refs/heads/master d74572ac9 -> 69da13ff6


LUCENE-7125: remove additional confusion (we already quantize once, don't do it again).


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

Branch: refs/heads/master
Commit: 69da13ff6f9fc6cbe77f587b880fad6834075f34
Parents: d74572a
Author: Robert Muir <rm...@apache.org>
Authored: Mon Mar 21 22:47:31 2016 -0400
Committer: Robert Muir <rm...@apache.org>
Committed: Mon Mar 21 22:47:31 2016 -0400

----------------------------------------------------------------------
 .../lucene/search/TestLatLonPointQueries.java   | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/69da13ff/lucene/sandbox/src/test/org/apache/lucene/search/TestLatLonPointQueries.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/search/TestLatLonPointQueries.java b/lucene/sandbox/src/test/org/apache/lucene/search/TestLatLonPointQueries.java
index 3b48eee..5831095 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/search/TestLatLonPointQueries.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/search/TestLatLonPointQueries.java
@@ -53,28 +53,14 @@ public class TestLatLonPointQueries extends BaseGeoPointTestCase {
 
   @Override
   protected Boolean rectContainsPoint(GeoRect rect, double pointLat, double pointLon) {
-
     assert Double.isNaN(pointLat) == false;
 
-    int rectLatMinEnc = LatLonPoint.encodeLatitude(rect.minLat);
-    int rectLatMaxEnc = LatLonPoint.encodeLatitude(rect.maxLat);
-    int rectLonMinEnc = LatLonPoint.encodeLongitude(rect.minLon);
-    int rectLonMaxEnc = LatLonPoint.encodeLongitude(rect.maxLon);
-
-    int pointLatEnc = LatLonPoint.encodeLatitude(pointLat);
-    int pointLonEnc = LatLonPoint.encodeLongitude(pointLon);
-
     if (rect.minLon < rect.maxLon) {
-      return pointLatEnc >= rectLatMinEnc &&
-        pointLatEnc <= rectLatMaxEnc &&
-        pointLonEnc >= rectLonMinEnc &&
-        pointLonEnc <= rectLonMaxEnc;
+      return GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, rect.minLon, rect.minLat, rect.maxLon, rect.maxLat);
     } else {
       // Rect crosses dateline:
-      return pointLatEnc >= rectLatMinEnc &&
-        pointLatEnc <= rectLatMaxEnc &&
-        (pointLonEnc >= rectLonMinEnc ||
-         pointLonEnc <= rectLonMaxEnc);
+      return GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, -180.0, rect.minLat, rect.maxLon, rect.maxLat)
+          || GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, rect.minLon, rect.minLat, 180.0, rect.maxLat);
     }
   }