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 14:36:52 UTC

svn commit: r1695494 - in /lucene/dev/branches/lucene6699/lucene/spatial3d/src: java/org/apache/lucene/bkdtree3d/ test/org/apache/lucene/bkdtree3d/

Author: mikemccand
Date: Wed Aug 12 12:36:51 2015
New Revision: 1695494

URL: http://svn.apache.org/r1695494
Log:
LUCENE-6699: fix some nocommits

Added:
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java
      - copied, changed from r1695400, lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointField.java
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java
      - copied, changed from r1695409, lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointInGeoShapeQuery.java
Removed:
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointField.java
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointInGeoShapeQuery.java
Modified:
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeDocValuesFormat.java
    lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestBKD3DTree.java

Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeDocValuesFormat.java?rev=1695494&r1=1695493&r2=1695494&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DTreeDocValuesFormat.java Wed Aug 12 12:36:51 2015
@@ -61,6 +61,8 @@ import org.apache.lucene.index.SegmentWr
  *
  * @lucene.experimental */
 
+// nocommit rename to Geo3DDVF
+
 public class BKD3DTreeDocValuesFormat extends DocValuesFormat {
 
   static final String DATA_CODEC_NAME = "BKD3DData";

Copied: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java (from r1695400, lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointField.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java?p2=lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java&p1=lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointField.java&r1=1695400&r2=1695494&rev=1695494&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointField.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/Geo3DPointField.java Wed Aug 12 12:36:51 2015
@@ -29,7 +29,7 @@ import org.apache.lucene.util.BytesRef;
 // nocommit what about multi-valued?
 
 /** Add this to a document to index lat/lon point, but be sure to use {@link BKD3DTreeDocValuesFormat} for the field. */
-public final class BKD3DPointField extends Field {
+public final class Geo3DPointField extends Field {
 
   public static final FieldType TYPE = new FieldType();
   static {
@@ -40,11 +40,11 @@ public final class BKD3DPointField exten
   // nocommit should we also have version that takes lat/lon and converts up front?
 
   /** 
-   * Creates a new BKD3DPointField field with the specified lat, lon (in radians), given a planet model.
+   * Creates a new Geo3DPointField field with the specified lat, lon (in radians), given a planet model.
    *
    * @throws IllegalArgumentException if the field name is null or lat or lon are out of bounds
    */
-  public BKD3DPointField(String name, final PlanetModel planetModel, final double lat, final double lon) {
+  public Geo3DPointField(String name, final PlanetModel planetModel, final double lat, final double lon) {
     super(name, TYPE);
     final GeoPoint point = new GeoPoint(planetModel, lat, lon);
     byte[] bytes = new byte[12];
@@ -55,11 +55,11 @@ public final class BKD3DPointField exten
   }
 
   /** 
-   * Creates a new BKD3DPointField field with the specified x,y,z.
+   * Creates a new Geo3DPointField field with the specified x,y,z.
    *
    * @throws IllegalArgumentException if the field name is null or lat or lon are out of bounds
    */
-  public BKD3DPointField(String name, double x, double y, double z) {
+  public Geo3DPointField(String name, double x, double y, double z) {
     super(name, TYPE);
     byte[] bytes = new byte[12];
     BKD3DTreeDocValuesFormat.writeInt(BKD3DTreeDocValuesFormat.encodeValue(x), bytes, 0);

Copied: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java (from r1695409, lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointInGeoShapeQuery.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java?p2=lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java&p1=lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointInGeoShapeQuery.java&r1=1695409&r2=1695494&rev=1695494&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/BKD3DPointInGeoShapeQuery.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java Wed Aug 12 12:36:51 2015
@@ -56,13 +56,13 @@ import java.util.Set;
  *
  * @lucene.experimental */
 
-public class BKD3DPointInGeoShapeQuery extends Query {
+public class PointInGeo3DShapeQuery extends Query {
   final String field;
   final PlanetModel planetModel;
   final GeoShape shape;
 
   /** The lats/lons must be clockwise or counter-clockwise. */
-  public BKD3DPointInGeoShapeQuery(PlanetModel planetModel, String field, GeoShape shape) {
+  public PointInGeo3DShapeQuery(PlanetModel planetModel, String field, GeoShape shape) {
     this.field = field;
     this.planetModel = planetModel;
     this.shape = shape;
@@ -153,7 +153,7 @@ public class BKD3DPointInGeoShapeQuery e
     if (o == null || getClass() != o.getClass()) return false;
     if (!super.equals(o)) return false;
 
-    BKD3DPointInGeoShapeQuery that = (BKD3DPointInGeoShapeQuery) o;
+    PointInGeo3DShapeQuery that = (PointInGeo3DShapeQuery) o;
 
     return planetModel.equals(that.planetModel) && shape.equals(that.shape);
   }

Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestBKD3DTree.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestBKD3DTree.java?rev=1695494&r1=1695493&r2=1695494&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestBKD3DTree.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestBKD3DTree.java Wed Aug 12 12:36:51 2015
@@ -112,9 +112,8 @@ public class TestBKD3DTree extends Lucen
   }
 
   private double randomCoord() {
-    // nocommit
-    //return (random().nextDouble()*2.0022) - 1.0011;
-    return (random().nextDouble()*.002) - .001;
+    return (random().nextDouble()*2.0022) - 1.0011;
+    //return (random().nextDouble()*.002) - .001;
   }
 
   private Range randomRange() {
@@ -129,16 +128,11 @@ public class TestBKD3DTree extends Lucen
 
   public void testRandom() throws Exception {
     List<Point> points = new ArrayList<>();
-    // nocommit
-    //int numPoints = atLeast(10000);
-    int numPoints = atLeast(200);
+    int numPoints = atLeast(10000);
     Directory dir = newDirectory();
     IndexOutput out = dir.createOutput("bkd", IOContext.DEFAULT);
     int maxPointsInLeaf = TestUtil.nextInt(random(), 16, 2048); 
 
-    // nocommit
-    maxPointsInLeaf = 100;
-
     int maxPointsSortInHeap = TestUtil.nextInt(random(), maxPointsInLeaf, 1024*1024);
 
     BKD3DTreeWriter w = new BKD3DTreeWriter(maxPointsInLeaf, maxPointsSortInHeap);
@@ -256,8 +250,7 @@ public class TestBKD3DTree extends Lucen
         Point point = points.get(docID);
         boolean actual = matches.get(docID);
 
-        // nocommit no good the test is "using" some of the code it's supposed to test ...
-        // nocommit wait: this shouldn't be necessary?  bkd tree IS precise?
+        // We must quantize exactly as BKD tree does else we'll get false failures
         int xEnc = encodeValue(point.x);
         int yEnc = encodeValue(point.y);
         int zEnc = encodeValue(point.z);