LUCENE-7331: Remove GeoPointTestUtil from TestGeoPointQuery.

This commit is contained in:
Nicholas Knize 2016-06-10 12:30:46 -05:00
parent b9fb98d59a
commit 7448abb3bc
2 changed files with 20 additions and 19 deletions

View File

@ -55,7 +55,7 @@ final class GeoPointPrefixTermsEnum extends GeoPointTermsEnum {
public GeoPointPrefixTermsEnum(final TermsEnum tenum, final GeoPointMultiTermQuery query) { public GeoPointPrefixTermsEnum(final TermsEnum tenum, final GeoPointMultiTermQuery query) {
super(tenum, query); super(tenum, query);
this.start = GeoPointField.encodeLatLon(query.minLat, query.minLon); 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) // start shift at maxShift value (from computeMaxShift)
this.shift = maxShift; this.shift = maxShift;
final long mask = (1L << shift) - 1; final long mask = (1L << shift) - 1;

View File

@ -17,12 +17,15 @@
package org.apache.lucene.spatial.geopoint.search; package org.apache.lucene.spatial.geopoint.search;
import org.apache.lucene.document.Document; 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.search.Query;
import org.apache.lucene.geo.BaseGeoPointTestCase; import org.apache.lucene.geo.BaseGeoPointTestCase;
import org.apache.lucene.geo.Polygon; 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;
import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding; import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
import org.apache.lucene.store.Directory;
/** /**
* random testing for GeoPoint query logic * random testing for GeoPoint query logic
@ -61,25 +64,23 @@ public class TestGeoPointQuery extends BaseGeoPointTestCase {
return new GeoPointInPolygonQuery(field, TermEncoding.PREFIX, polygons); 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 // add a doc with a point
protected double nextLongitude() { Document document = new Document();
return GeoPointTestUtil.nextLongitude(); addPointToDoc("field", document, 80, -65);
} writer.addDocument(document);
@Override // search and verify we found our doc
protected double nextLatitude() { IndexReader reader = writer.getReader();
return GeoPointTestUtil.nextLatitude(); IndexSearcher searcher = newSearcher(reader);
} assertEquals(0, searcher.count(newRectQuery("field", 90, 90, -180, 0)));
@Override reader.close();
protected Rectangle nextBox() { writer.close();
return GeoPointTestUtil.nextBox(); dir.close();
}
@Override
protected Polygon nextPolygon() {
return GeoPointTestUtil.nextPolygon();
} }
} }