lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkn...@apache.org
Subject lucene-solr:branch_6_1: LUCENE-7331: Remove GeoPointTestUtil from TestGeoPointQuery.
Date Fri, 10 Jun 2016 17:39:50 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6_1 f77afe120 -> 1bbac6bbd


LUCENE-7331: Remove GeoPointTestUtil from TestGeoPointQuery.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1bbac6bb
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1bbac6bb
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1bbac6bb

Branch: refs/heads/branch_6_1
Commit: 1bbac6bbd896c110d08656f79fef3ce6d7828d6b
Parents: f77afe1
Author: Nicholas Knize <nknize@gmail.com>
Authored: Fri Jun 10 12:30:46 2016 -0500
Committer: Nicholas Knize <nknize@gmail.com>
Committed: Fri Jun 10 12:38:20 2016 -0500

----------------------------------------------------------------------
 .../search/GeoPointPrefixTermsEnum.java         |  2 +-
 .../geopoint/search/TestGeoPointQuery.java      | 37 ++++++++++----------
 2 files changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1bbac6bb/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointPrefixTermsEnum.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointPrefixTermsEnum.java
b/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointPrefixTermsEnum.java
index 6429b92..c8975f2 100644
--- a/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointPrefixTermsEnum.java
+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointPrefixTermsEnum.java
@@ -55,7 +55,7 @@ final class GeoPointPrefixTermsEnum extends GeoPointTermsEnum {
   public GeoPointPrefixTermsEnum(final TermsEnum tenum, final GeoPointMultiTermQuery query)
{
     super(tenum, query);
     this.start = GeoPointField.encodeLatLon(query.minLat, query.minLon);
-    this.currentRange = new Range(0, shift, true);
+    this.currentRange = new Range(-1, shift, true);
     // start shift at maxShift value (from computeMaxShift)
     this.shift = maxShift;
     final long mask = (1L << shift) - 1;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1bbac6bb/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
index cfd6630..8aeb5b8 100644
--- a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
@@ -17,12 +17,15 @@
 package org.apache.lucene.spatial.geopoint.search;
 
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.geo.BaseGeoPointTestCase;
 import org.apache.lucene.geo.Polygon;
-import org.apache.lucene.geo.Rectangle;
 import org.apache.lucene.spatial.geopoint.document.GeoPointField;
 import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
+import org.apache.lucene.store.Directory;
 
 /**
  * random testing for GeoPoint query logic
@@ -61,25 +64,23 @@ public class TestGeoPointQuery extends BaseGeoPointTestCase {
     return new GeoPointInPolygonQuery(field, TermEncoding.PREFIX, polygons);
   }
 
-  // TODO: remove these once we get tests passing!
+  /** explicit test failure for LUCENE-7325 */
+  public void testInvalidShift() throws Exception {
+    Directory dir = newDirectory();
+    RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
 
-  @Override
-  protected double nextLongitude() {
-    return GeoPointTestUtil.nextLongitude();
-  }
-
-  @Override
-  protected double nextLatitude() {
-    return GeoPointTestUtil.nextLatitude();
-  }
+    // add a doc with a point
+    Document document = new Document();
+    addPointToDoc("field", document, 80, -65);
+    writer.addDocument(document);
 
-  @Override
-  protected Rectangle nextBox() {
-    return GeoPointTestUtil.nextBox();
-  }
+    // search and verify we found our doc
+    IndexReader reader = writer.getReader();
+    IndexSearcher searcher = newSearcher(reader);
+    assertEquals(0, searcher.count(newRectQuery("field", 90, 90, -180, 0)));
 
-  @Override
-  protected Polygon nextPolygon() {
-    return GeoPointTestUtil.nextPolygon();
+    reader.close();
+    writer.close();
+    dir.close();
   }
 }


Mime
View raw message