lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject lucene-solr:branch_6x: LUCENE-7225: Fix Geo3DRelations test to use the correct measure of 'truth' in assessing relationships.
Date Sat, 16 Apr 2016 08:10:11 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x e1a5665fe -> 9ab336ebb


LUCENE-7225: Fix Geo3DRelations test to use the correct measure of 'truth' in assessing relationships.


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

Branch: refs/heads/branch_6x
Commit: 9ab336ebb3efd8a0356ff43e0dcb74b810a7ee09
Parents: e1a5665
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Sat Apr 16 04:07:10 2016 -0400
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Sat Apr 16 04:08:57 2016 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial3d/TestGeo3DPoint.java   | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ab336eb/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
index 330a15e..48e7f0a 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -195,10 +195,12 @@ public class TestGeo3DPoint extends LuceneTestCase {
     }
 
     GeoPoint[] docs = new GeoPoint[numDocs];
+    GeoPoint[] unquantizedDocs = new GeoPoint[numDocs];
     for(int docID=0;docID<numDocs;docID++) {
-      docs[docID] = quantize(new GeoPoint(PlanetModel.WGS84, toRadians(GeoTestUtil.nextLatitude()),
toRadians(GeoTestUtil.nextLongitude())));
+      unquantizedDocs[docID] = new GeoPoint(PlanetModel.WGS84, toRadians(GeoTestUtil.nextLatitude()),
toRadians(GeoTestUtil.nextLongitude()));
+      docs[docID] = quantize(unquantizedDocs[docID]);
       if (VERBOSE) {
-        System.out.println("  doc=" + docID + ": " + docs[docID]);
+        System.out.println("  doc=" + docID + ": " + docs[docID] + "; unquantized: "+unquantizedDocs[docID]);
       }
     }
 
@@ -253,15 +255,18 @@ public class TestGeo3DPoint extends LuceneTestCase {
           // Leaf cell: brute force check all docs that fall within this cell:
           for(int docID=0;docID<numDocs;docID++) {
             GeoPoint point = docs[docID];
+            GeoPoint mappedPoint = unquantizedDocs[docID];
+            boolean pointWithinShape = shape.isWithin(point);
+            boolean mappedPointWithinShape = shape.isWithin(mappedPoint);
             if (cell.contains(point)) {
-              if (shape.isWithin(point)) {
+              if (mappedPointWithinShape) {
                 if (VERBOSE) {
-                  log.println("    check doc=" + docID + ": match!");
+                  log.println("    check doc=" + docID + ": match!  Actual quantized point
within: "+pointWithinShape);
                 }
                 hits.add(docID);
               } else {
                 if (VERBOSE) {
-                  log.println("    check doc=" + docID + ": no match");
+                  log.println("    check doc=" + docID + ": no match.  Quantized point within:
"+pointWithinShape);
                 }
               }
             }
@@ -416,7 +421,8 @@ public class TestGeo3DPoint extends LuceneTestCase {
       boolean fail = false;
       for(int docID=0;docID<numDocs;docID++) {
         GeoPoint point = docs[docID];
-        boolean expected = shape.isWithin(point);
+        GeoPoint mappedPoint = unquantizedDocs[docID];
+        boolean expected = shape.isWithin(mappedPoint);
         boolean actual = hits.contains(docID);
         if (actual != expected) {
           if (actual) {


Mime
View raw message