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/12 15:37:17 UTC

svn commit: r1695513 - in /lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d: BKD3DTreeReader.java BKD3DTreeWriter.java Geo3DPointField.java

Author: mikemccand
Date: Wed Aug 12 13:37:16 2015
New Revision: 1695513

URL: http://svn.apache.org/r1695513
Log:
LUCENE-6699: don't use the global min/max

Modified:
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeReader.java
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeWriter.java
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java

Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeReader.java?rev=1695513&r1=1695512&r2=1695513&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeReader.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeReader.java Wed Aug 12 13:37:16 2015
@@ -37,12 +37,6 @@ final class BKD3DTreeReader implements A
   final private long[] leafBlockFPs;
   final int maxDoc;
   final IndexInput in;
-  final int globalMinX;
-  final int globalMaxX;
-  final int globalMinY;
-  final int globalMaxY;
-  final int globalMinZ;
-  final int globalMaxZ;
 
   enum Relation {INSIDE, CROSSES, OUTSIDE};
 
@@ -53,14 +47,6 @@ final class BKD3DTreeReader implements A
 
   public BKD3DTreeReader(IndexInput in, int maxDoc) throws IOException {
 
-    // nocommit is this really worth it?
-    globalMinX = in.readInt();
-    globalMaxX = in.readInt();
-    globalMinY = in.readInt();
-    globalMaxY = in.readInt();
-    globalMinZ = in.readInt();
-    globalMaxZ = in.readInt();
-
     // Read index:
     int numLeaves = in.readVInt();
     leafNodeOffset = numLeaves;
@@ -110,9 +96,9 @@ final class BKD3DTreeReader implements A
   }
 
   public DocIdSet intersect(ValueFilter filter) throws IOException {
-    return intersect(globalMinX, globalMaxX,
-                     globalMinY, globalMaxY,
-                     globalMinZ, globalMaxZ,
+    return intersect(Integer.MIN_VALUE, Integer.MAX_VALUE,
+                     Integer.MIN_VALUE, Integer.MAX_VALUE,
+                     Integer.MIN_VALUE, Integer.MAX_VALUE,
                      filter);
   }
 
@@ -127,9 +113,9 @@ final class BKD3DTreeReader implements A
                                       filter);
 
     int hitCount = intersect(state, 1,
-                             globalMinX, globalMaxX,
-                             globalMinY, globalMaxY,
-                             globalMinZ, globalMaxZ);
+                             Integer.MIN_VALUE, Integer.MAX_VALUE,
+                             Integer.MIN_VALUE, Integer.MAX_VALUE,
+                             Integer.MIN_VALUE, Integer.MAX_VALUE);
 
     // NOTE: hitCount is an over-estimate in the multi-valued case:
     return state.docs.build(hitCount);

Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeWriter.java?rev=1695513&r1=1695512&r2=1695513&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeWriter.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeWriter.java Wed Aug 12 13:37:16 2015
@@ -93,12 +93,6 @@ class BKD3DTreeWriter {
   private final int maxPointsSortInHeap;
 
   private long pointCount;
-  private int globalMinX = Integer.MAX_VALUE;
-  private int globalMaxX = Integer.MIN_VALUE;
-  private int globalMinY = Integer.MAX_VALUE;
-  private int globalMaxY = Integer.MIN_VALUE;
-  private int globalMinZ = Integer.MAX_VALUE;
-  private int globalMaxZ = Integer.MIN_VALUE;
 
   public BKD3DTreeWriter() throws IOException {
     this(DEFAULT_MAX_POINTS_IN_LEAF_NODE, DEFAULT_MAX_POINTS_SORT_IN_HEAP);
@@ -171,12 +165,6 @@ class BKD3DTreeWriter {
     }
 
     pointCount++;
-    globalMinX = Math.min(globalMinX, x);
-    globalMaxX = Math.max(globalMaxX, x);
-    globalMinY = Math.min(globalMinY, y);
-    globalMaxY = Math.max(globalMaxY, y);
-    globalMinZ = Math.min(globalMinZ, z);
-    globalMaxZ = Math.max(globalMaxZ, z);
   }
 
   /** Changes incoming {@link ByteSequencesWriter} file to to fixed-width-per-entry file, because we need to be able to slice
@@ -415,9 +403,9 @@ class BKD3DTreeWriter {
             new PathSlice(ySortedWriter, 0, pointCount),
             new PathSlice(zSortedWriter, 0, pointCount),
             bitSet, out,
-            globalMinX, globalMaxX,
-            globalMinY, globalMaxY,
-            globalMinZ, globalMaxZ,
+            Integer.MIN_VALUE, Integer.MAX_VALUE,
+            Integer.MIN_VALUE, Integer.MAX_VALUE,
+            Integer.MIN_VALUE, Integer.MAX_VALUE,
             splitValues,
             leafBlockFPs);
       success = true;
@@ -452,12 +440,6 @@ class BKD3DTreeWriter {
     // Write index:
     long indexFP = out.getFilePointer();
     //System.out.println("indexFP=" + indexFP);
-    out.writeInt(globalMinX);
-    out.writeInt(globalMaxX);
-    out.writeInt(globalMinY);
-    out.writeInt(globalMaxY);
-    out.writeInt(globalMinZ);
-    out.writeInt(globalMaxZ);
     out.writeVInt(numLeaves);
 
     // NOTE: splitValues[0] is unused, because nodeID is 1-based:

Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java?rev=1695513&r1=1695512&r2=1695513&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java Wed Aug 12 13:37:16 2015
@@ -46,7 +46,6 @@ public final class Geo3DPointField exten
    */
   public Geo3DPointField(String name, final PlanetModel planetModel, final double lat, final double lon) {
     super(name, TYPE);
-    System.out.println("HERE: " + lat);
     final GeoPoint point = new GeoPoint(planetModel, lat, lon);
     byte[] bytes = new byte[12];
     BKD3DTreeDocValuesFormat.writeInt(BKD3DTreeDocValuesFormat.encodeValue(point.x), bytes, 0);