You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2016/04/16 16:15:12 UTC
[1/3] lucene-solr:master: LUCENE-7225: Handle case where we don't
know what truth is properly.
Repository: lucene-solr
Updated Branches:
refs/heads/master aeea49331 -> 7b6423c2c
LUCENE-7225: Handle case where we don't know what truth is properly.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8ffb2d19
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8ffb2d19
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8ffb2d19
Branch: refs/heads/master
Commit: 8ffb2d19e860c5ed71dd8d748fb375de03dbaec9
Parents: 9222104
Author: Karl Wright <Da...@gmail.com>
Authored: Sat Apr 16 08:29:43 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sat Apr 16 08:29:43 2016 -0400
----------------------------------------------------------------------
.../spatial3d/PointInShapeIntersectVisitor.java | 35 +++++++++---
.../apache/lucene/spatial3d/TestGeo3DPoint.java | 58 ++++++++++++--------
.../lucene/spatial3d/geom/GeoBBoxTest.java | 2 +-
3 files changed, 61 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8ffb2d19/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
index 348396b..268f3ce 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
@@ -46,14 +46,31 @@ class PointInShapeIntersectVisitor implements IntersectVisitor {
@Override
public void visit(int docID, byte[] packedValue) {
assert packedValue.length == 12;
- double x = Geo3DPoint.decodeDimension(packedValue, 0);
- double y = Geo3DPoint.decodeDimension(packedValue, Integer.BYTES);
- double z = Geo3DPoint.decodeDimension(packedValue, 2 * Integer.BYTES);
- if (x >= shapeBounds.getMinimumX() && x <= shapeBounds.getMaximumX() &&
- y >= shapeBounds.getMinimumY() && y <= shapeBounds.getMaximumY() &&
- z >= shapeBounds.getMinimumZ() && z <= shapeBounds.getMaximumZ()) {
- if (shape.isWithin(x, y, z)) {
- hits.add(docID);
+ final int xInt = NumericUtils.sortableBytesToInt(packedValue, 0);
+ final double xMin = Geo3DUtil.decodeValueFloor(xInt);
+ final double xMax = Geo3DUtil.decodeValueCeil(xInt);
+ if (xMin >= shapeBounds.getMinimumX() && xMin <= shapeBounds.getMaximumX() ||
+ xMax >= shapeBounds.getMinimumX() && xMax <= shapeBounds.getMaximumX()) {
+ // X is OK
+ final int yInt = NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES);
+ final double yMin = Geo3DUtil.decodeValueFloor(yInt);
+ final double yMax = Geo3DUtil.decodeValueCeil(yInt);
+ if (yMin >= shapeBounds.getMinimumY() && yMin <= shapeBounds.getMaximumY() ||
+ yMax >= shapeBounds.getMinimumY() && yMax <= shapeBounds.getMaximumY()) {
+ // Y is OK
+ final int zInt = NumericUtils.sortableBytesToInt(packedValue, 2 * Integer.BYTES);
+ final double zMin = Geo3DUtil.decodeValueFloor(zInt);
+ final double zMax = Geo3DUtil.decodeValueCeil(zInt);
+ if (zMin >= shapeBounds.getMinimumZ() && zMin <= shapeBounds.getMaximumZ() ||
+ zMax >= shapeBounds.getMinimumZ() && zMax <= shapeBounds.getMaximumZ()) {
+ // Z is OK
+ final double x = Geo3DUtil.decodeValue(xInt);
+ final double y = Geo3DUtil.decodeValue(yInt);
+ final double z = Geo3DUtil.decodeValue(zInt);
+ if (shape.isWithin(x, y, z)) {
+ hits.add(docID);
+ }
+ }
}
}
}
@@ -82,7 +99,7 @@ class PointInShapeIntersectVisitor implements IntersectVisitor {
shapeBounds.getMinimumZ() >= zMin && shapeBounds.getMaximumZ() <= zMax) {
return Relation.CELL_CROSSES_QUERY;
}
-
+
// Quick test failed so do slower one...
GeoArea xyzSolid = GeoAreaFactory.makeGeoArea(PlanetModel.WGS84, xMin, xMax, yMin, yMax, zMin, zMax);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8ffb2d19/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 48e7f0a..a8a7300 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -686,12 +686,14 @@ public class TestGeo3DPoint extends LuceneTestCase {
IndexWriterConfig iwc = newIndexWriterConfig();
GeoPoint[] points = new GeoPoint[lats.length];
-
+ GeoPoint[] unquantizedPoints = new GeoPoint[lats.length];
+
// Pre-quantize all lat/lons:
for(int i=0;i<lats.length;i++) {
if (Double.isNaN(lats[i]) == false) {
//System.out.println("lats[" + i + "] = " + lats[i]);
- points[i] = quantize(new GeoPoint(PlanetModel.WGS84, toRadians(lats[i]), toRadians(lons[i])));
+ unquantizedPoints[i] = new GeoPoint(PlanetModel.WGS84, toRadians(lats[i]), toRadians(lons[i]));
+ points[i] = quantize(unquantizedPoints[i]);
}
}
@@ -789,26 +791,36 @@ public class TestGeo3DPoint extends LuceneTestCase {
for(int docID=0;docID<r.maxDoc();docID++) {
int id = (int) docIDToID.get(docID);
GeoPoint point = points[id];
- if (point != null) {
- boolean expected = ((deleted.contains(id) == false) && ((PointInGeo3DShapeQuery)query).getShape().isWithin(point));
+ GeoPoint unquantizedPoint = unquantizedPoints[id];
+ if (point != null && unquantizedPoint != null) {
+ GeoShape shape = ((PointInGeo3DShapeQuery)query).getShape();
+ // If there's a conflict, we don't know what 'truth' actually is; either result is OK
+ boolean conflict = shape.isWithin(point) != shape.isWithin(unquantizedPoint);
+ boolean expected = ((deleted.contains(id) == false) && shape.isWithin(unquantizedPoint));
if (hits.get(docID) != expected) {
- GeoPoint scaledPoint = PlanetModel.WGS84.createSurfacePoint(point);
- StringBuilder b = new StringBuilder();
- if (expected) {
- b.append("FAIL: id=" + id + " should have matched but did not\n");
+ if (conflict) {
+ if (VERBOSE) {
+ System.err.println("CONFLICT: id=" + id + " quantized point membership disagrees with non-quantized point: truth unknown");
+ }
} else {
- b.append("FAIL: id=" + id + " should not have matched but did\n");
+ StringBuilder b = new StringBuilder();
+ if (expected) {
+ b.append("FAIL: id=" + id + " should have matched but did not\n");
+ } else {
+ b.append("FAIL: id=" + id + " should not have matched but did\n");
+ }
+ b.append(" shape=" + ((PointInGeo3DShapeQuery)query).getShape() + "\n");
+ b.append(" world bounds=(" +
+ " minX=" + PlanetModel.WGS84.getMinimumXValue() + " maxX=" + PlanetModel.WGS84.getMaximumXValue() +
+ " minY=" + PlanetModel.WGS84.getMinimumYValue() + " maxY=" + PlanetModel.WGS84.getMaximumYValue() +
+ " minZ=" + PlanetModel.WGS84.getMinimumZValue() + " maxZ=" + PlanetModel.WGS84.getMaximumZValue() + "\n");
+ b.append(" quantized point=" + point + " within shape? "+shape.isWithin(point)+"\n");
+ b.append(" unquantized point=" + unquantizedPoint + " within shape? "+shape.isWithin(unquantizedPoint)+"\n");
+ b.append(" docID=" + docID + " deleted?=" + deleted.contains(id) + "\n");
+ b.append(" query=" + query + "\n");
+ b.append(" explanation:\n " + explain("point", shape, point, unquantizedPoint, r, docID).replace("\n", "\n "));
+ fail(b.toString());
}
- b.append(" shape=" + ((PointInGeo3DShapeQuery)query).getShape() + "\n");
- b.append(" world bounds=(" +
- " minX=" + PlanetModel.WGS84.getMinimumXValue() + " maxX=" + PlanetModel.WGS84.getMaximumXValue() +
- " minY=" + PlanetModel.WGS84.getMinimumYValue() + " maxY=" + PlanetModel.WGS84.getMaximumYValue() +
- " minZ=" + PlanetModel.WGS84.getMinimumZValue() + " maxZ=" + PlanetModel.WGS84.getMaximumZValue() + "\n");
- b.append(" point=" + point + "\n");
- b.append(" docID=" + docID + " deleted?=" + deleted.contains(id) + "\n");
- b.append(" query=" + query + "\n");
- b.append(" explanation:\n " + explain("point", ((PointInGeo3DShapeQuery)query).getShape(), point, scaledPoint, r, docID).replace("\n", "\n "));
- fail(b.toString());
}
} else {
assertFalse(hits.get(docID));
@@ -1271,7 +1283,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
} else {
Relation result = in.compare(minPackedValue, maxPackedValue);
if (targetStackUpto < stackToTargetDoc.size() && cell.equals(stackToTargetDoc.get(targetStackUpto))) {
- b.append(" on cell " + stackToTargetDoc.get(targetStackUpto) + ", wrapped visitor returned " + result);
+ b.append(" on cell " + stackToTargetDoc.get(targetStackUpto) + ", wrapped visitor returned " + result + "\n");
targetStackUpto++;
}
return result;
@@ -1314,9 +1326,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
double zMax = Geo3DUtil.decodeValueCeil(NumericUtils.sortableBytesToInt(maxPackedValue, 2 * Integer.BYTES));
final XYZSolid xyzSolid = XYZSolidFactory.makeXYZSolid(PlanetModel.WGS84, xMin, xMax, yMin, yMax, zMin, zMax);
final int relationship = xyzSolid.getRelationship(shape);
- final boolean pointWithinShape = shape.isWithin(targetDocPoint);
final boolean pointWithinCell = xyzSolid.isWithin(targetDocPoint);
- final boolean scaledWithinShape = shape.isWithin(scaledDocPoint);
final boolean scaledWithinCell = xyzSolid.isWithin(scaledDocPoint);
final String relationshipString;
@@ -1339,8 +1349,8 @@ public class TestGeo3DPoint extends LuceneTestCase {
}
return "Cell(x=" + xMin + " TO " + xMax + " y=" + yMin + " TO " + yMax + " z=" + zMin + " TO " + zMax +
"); Shape relationship = "+relationshipString+
- "; Point within cell = "+pointWithinCell+"; Point within shape = "+pointWithinShape+
- "; Scaled point within cell = "+scaledWithinCell+"; Scaled point within shape = "+scaledWithinShape;
+ "; Quantized point within cell = "+pointWithinCell+
+ "; Unquantized point within cell = "+scaledWithinCell;
}
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8ffb2d19/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoBBoxTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoBBoxTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoBBoxTest.java
index f5a148f..4442a79 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoBBoxTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoBBoxTest.java
@@ -360,5 +360,5 @@ public class GeoBBoxTest {
//assertEquals(Math.PI,b.getRightLongitude(),0.000001);
}
-
+
}
[2/3] lucene-solr:master: LUCENE-7225: Undo fancy visit code;
it won't do anything useful anyway.
Posted by kw...@apache.org.
LUCENE-7225: Undo fancy visit code; it won't do anything useful anyway.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/22a23f66
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/22a23f66
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/22a23f66
Branch: refs/heads/master
Commit: 22a23f66f779e139dd7338681c53592ca1b1f7ec
Parents: 8ffb2d1
Author: Karl Wright <Da...@gmail.com>
Authored: Sat Apr 16 10:12:53 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sat Apr 16 10:12:53 2016 -0400
----------------------------------------------------------------------
.../spatial3d/PointInShapeIntersectVisitor.java | 33 +++++---------------
1 file changed, 8 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/22a23f66/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
index 268f3ce..d4e7309 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/PointInShapeIntersectVisitor.java
@@ -46,31 +46,14 @@ class PointInShapeIntersectVisitor implements IntersectVisitor {
@Override
public void visit(int docID, byte[] packedValue) {
assert packedValue.length == 12;
- final int xInt = NumericUtils.sortableBytesToInt(packedValue, 0);
- final double xMin = Geo3DUtil.decodeValueFloor(xInt);
- final double xMax = Geo3DUtil.decodeValueCeil(xInt);
- if (xMin >= shapeBounds.getMinimumX() && xMin <= shapeBounds.getMaximumX() ||
- xMax >= shapeBounds.getMinimumX() && xMax <= shapeBounds.getMaximumX()) {
- // X is OK
- final int yInt = NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES);
- final double yMin = Geo3DUtil.decodeValueFloor(yInt);
- final double yMax = Geo3DUtil.decodeValueCeil(yInt);
- if (yMin >= shapeBounds.getMinimumY() && yMin <= shapeBounds.getMaximumY() ||
- yMax >= shapeBounds.getMinimumY() && yMax <= shapeBounds.getMaximumY()) {
- // Y is OK
- final int zInt = NumericUtils.sortableBytesToInt(packedValue, 2 * Integer.BYTES);
- final double zMin = Geo3DUtil.decodeValueFloor(zInt);
- final double zMax = Geo3DUtil.decodeValueCeil(zInt);
- if (zMin >= shapeBounds.getMinimumZ() && zMin <= shapeBounds.getMaximumZ() ||
- zMax >= shapeBounds.getMinimumZ() && zMax <= shapeBounds.getMaximumZ()) {
- // Z is OK
- final double x = Geo3DUtil.decodeValue(xInt);
- final double y = Geo3DUtil.decodeValue(yInt);
- final double z = Geo3DUtil.decodeValue(zInt);
- if (shape.isWithin(x, y, z)) {
- hits.add(docID);
- }
- }
+ double x = Geo3DPoint.decodeDimension(packedValue, 0);
+ double y = Geo3DPoint.decodeDimension(packedValue, Integer.BYTES);
+ double z = Geo3DPoint.decodeDimension(packedValue, 2 * Integer.BYTES);
+ if (x >= shapeBounds.getMinimumX() && x <= shapeBounds.getMaximumX() &&
+ y >= shapeBounds.getMinimumY() && y <= shapeBounds.getMaximumY() &&
+ z >= shapeBounds.getMinimumZ() && z <= shapeBounds.getMaximumZ()) {
+ if (shape.isWithin(x, y, z)) {
+ hits.add(docID);
}
}
}
[3/3] lucene-solr:master: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/lucene-solr
Posted by kw...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7b6423c2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7b6423c2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7b6423c2
Branch: refs/heads/master
Commit: 7b6423c2c760b0ab33c88905a504f9228bb0fb54
Parents: 22a23f6 aeea493
Author: Karl Wright <Da...@gmail.com>
Authored: Sat Apr 16 10:14:35 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sat Apr 16 10:14:35 2016 -0400
----------------------------------------------------------------------
.../src/java/org/apache/lucene/geo/EarthDebugger.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------