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:20:09 UTC

[2/2] lucene-solr:branch_6x: LUCENE-7225: Undo fancy visit code; it won't do anything useful anyway.

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/69dfdb77
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/69dfdb77
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/69dfdb77

Branch: refs/heads/branch_6x
Commit: 69dfdb771133262ab10b57967bb241f838476017
Parents: 080e67c
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:17:15 2016 -0400

----------------------------------------------------------------------
 .../spatial3d/PointInShapeIntersectVisitor.java | 33 +++++---------------
 1 file changed, 8 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/69dfdb77/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);
       }
     }
   }