LUCENE-7213: fix test bug when LatLonPoint.newBoxQuery returns MatchNoDocsQuery.

This commit is contained in:
Robert Muir 2016-04-13 18:52:32 -04:00
parent e4dcf423e3
commit 1a1c8dbfb3
1 changed files with 6 additions and 1 deletions

View File

@ -54,6 +54,7 @@ import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.SerialMergeScheduler;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.SimpleCollector;
@ -1387,7 +1388,11 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
q1 = newRectQuery("field", rect.minLat, rect.maxLat, rect.minLon, rect.maxLon);
q2 = newRectQuery("field", rect.minLat, rect.maxLat, rect.minLon, rect.maxLon);
assertEquals(q1, q2);
// for "impossible" ranges LatLonPoint.newBoxQuery will return MatchNoDocsQuery
// changing the field is unrelated to that.
if (q1 instanceof MatchNoDocsQuery == false) {
assertFalse(q1.equals(newRectQuery("field2", rect.minLat, rect.maxLat, rect.minLon, rect.maxLon)));
}
double lat = randomLat(false);
double lon = randomLon(false);