You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/08/19 23:04:00 UTC
svn commit: r1696669 -
/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java
Author: mikemccand
Date: Wed Aug 19 21:04:00 2015
New Revision: 1696669
URL: http://svn.apache.org/r1696669
Log:
LUCENE-6699: put fudge factor back
Modified:
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java?rev=1696669&r1=1696668&r2=1696669&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java Wed Aug 19 21:04:00 2015
@@ -105,12 +105,19 @@ public class PointInGeo3DShapeQuery exte
// nocommit sometimes returns CONTAINS too:
// assert xyzSolid.getRelationship(shape) == GeoArea.WITHIN || xyzSolid.getRelationship(shape) == GeoArea.OVERLAPS: "got " + xyzSolid.getRelationship(shape);
- DocIdSet result = tree.intersect(Geo3DDocValuesFormat.encodeValue(bounds.getMinimumX()),
- Geo3DDocValuesFormat.encodeValue(bounds.getMaximumX()),
- Geo3DDocValuesFormat.encodeValue(bounds.getMinimumY()),
- Geo3DDocValuesFormat.encodeValue(bounds.getMaximumY()),
- Geo3DDocValuesFormat.encodeValue(bounds.getMinimumZ()),
- Geo3DDocValuesFormat.encodeValue(bounds.getMaximumZ()),
+
+ // The fudge factor here (+/- 2.0 * MINIMUM_RESOLUTION) is here to ensure that
+ // you get a WITHIN rather than an OVERLAPS if you expand the bounding box by
+ // an amount sufficient to insure there are no overlaps between the shape and
+ // the box. Otherwise according to the (revised) definition of getRelationship(),
+ // you could technically get either one.
+
+ DocIdSet result = tree.intersect(Geo3DDocValuesFormat.encodeValue(bounds.getMinimumX() - 2.0 * Vector.MINIMUM_RESOLUTION),
+ Geo3DDocValuesFormat.encodeValue(bounds.getMaximumX() + 2.0 * Vector.MINIMUM_RESOLUTION),
+ Geo3DDocValuesFormat.encodeValue(bounds.getMinimumY() - 2.0 * Vector.MINIMUM_RESOLUTION),
+ Geo3DDocValuesFormat.encodeValue(bounds.getMaximumY() + 2.0 * Vector.MINIMUM_RESOLUTION),
+ Geo3DDocValuesFormat.encodeValue(bounds.getMinimumZ() - 2.0 * Vector.MINIMUM_RESOLUTION),
+ Geo3DDocValuesFormat.encodeValue(bounds.getMaximumZ() + 2.0 * Vector.MINIMUM_RESOLUTION),
new BKD3DTreeReader.ValueFilter() {
@Override
public boolean accept(int docID) {