LUCENE-7228: Bounds computations which use Lagrangian multipliers are inherently less precise, so make sure that the bounds values exceed the size of the shape by a comfortable amount.

This commit is contained in:
Karl Wright 2016-04-18 13:53:59 -04:00
parent a7b138317a
commit 7bd116c447
2 changed files with 9 additions and 4 deletions

View File

@ -29,7 +29,7 @@ public class XYZBounds implements Bounds {
* of the shape, and we cannot guarantee that without making MINIMUM_RESOLUTION
* unacceptably large.
*/
private static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 2.0;
private static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 500.0;
/** Minimum x */
private Double minX = null;

View File

@ -796,6 +796,10 @@ public class TestGeo3DPoint extends LuceneTestCase {
GeoPoint unquantizedPoint = unquantizedPoints[id];
if (point != null && unquantizedPoint != null) {
GeoShape shape = ((PointInGeo3DShapeQuery)query).getShape();
XYZBounds bounds = new XYZBounds();
shape.getBounds(bounds);
XYZSolid solid = XYZSolidFactory.makeXYZSolid(PlanetModel.WGS84, bounds.getMinimumX(), bounds.getMaximumX(), bounds.getMinimumY(), bounds.getMaximumY(), bounds.getMinimumZ(), bounds.getMaximumZ());
boolean expected = ((deleted.contains(id) == false) && shape.isWithin(point));
if (hits.get(docID) != expected) {
StringBuilder b = new StringBuilder();
@ -804,13 +808,14 @@ public class TestGeo3DPoint extends LuceneTestCase {
} else {
b.append("FAIL: id=" + id + " should not have matched but did\n");
}
b.append(" shape=" + ((PointInGeo3DShapeQuery)query).getShape() + "\n");
b.append(" shape=" + shape + "\n");
b.append(" bounds=" + bounds + "\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(" quantized point=" + point + " within shape? "+shape.isWithin(point)+" within bounds? "+solid.isWithin(point)+"\n");
b.append(" unquantized point=" + unquantizedPoint + " within shape? "+shape.isWithin(unquantizedPoint)+" within bounds? "+solid.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 "));