From 31d07eda18eb48be4153b9ee4d946719e7e333ac Mon Sep 17 00:00:00 2001 From: Karl Wright Date: Sun, 2 Oct 2016 15:43:23 -0400 Subject: [PATCH] LUCENE-7430: Add extra space in the shape bounding box to handle quantization issues. --- .../apache/lucene/spatial3d/Geo3DDocValuesField.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DDocValuesField.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DDocValuesField.java index ef33fd572bd..551fa5a8e4f 100644 --- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DDocValuesField.java +++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/Geo3DDocValuesField.java @@ -67,11 +67,17 @@ public class Geo3DDocValuesField extends Field { private final static double yFactor = 1.0 / inverseYFactor; private final static double zFactor = 1.0 / inverseZFactor; + // Fudge factor for step adjustments. This is here solely to handle inaccuracies in bounding boxes + // that occur because of quantization. For unknown reasons, the fudge factor needs to be + // 10.0 rather than 1.0. See LUCENE-7430. + + private final static double STEP_FUDGE = 10.0; + // These values are the delta between a value and the next value in each specific dimension - private final static double xStep = inverseXFactor; - private final static double yStep = inverseYFactor; - private final static double zStep = inverseZFactor; + private final static double xStep = inverseXFactor * STEP_FUDGE; + private final static double yStep = inverseYFactor * STEP_FUDGE; + private final static double zStep = inverseZFactor * STEP_FUDGE; /** * Type for a Geo3DDocValuesField