Skip to content

Apache Lucene open-source search software

LUCENE-10310: Fix test error in TestXYDocValuesQueries#testRandomDistanceHuge (#537)

Ignacio Vera5207aae52797
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index eb0d28d29a1..c1ce6cab356 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -110,6 +110,9 @@ Other
* LUCENE-10303: Upgrade log4j to 2.15.0. (Tomoko Uchida)
+* LUCENE-10310: TestXYDocValuesQueries#doRandomDistanceTest does not produce random circles with radius
+ with '0' value any longer.
+
======================= Lucene 9.0.0 =======================
New Features
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/BaseXYPointTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/geo/BaseXYPointTestCase.java
index b6cc893d5d1..b533d3ebfb1 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/BaseXYPointTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/BaseXYPointTestCase.java
@@ -1341,9 +1341,10 @@ public abstract class BaseXYPointTestCase extends LuceneTestCase {
IndexSearcher searcher = newSearcher(reader);
for (int i = 0; i < numQueries; i++) {
- float x = nextX();
- float y = nextY();
- float radius = (Float.MAX_VALUE / 2) * random().nextFloat();
+ XYCircle circle = ShapeTestUtil.nextCircle();
+ float x = circle.getX();
+ float y = circle.getY();
+ float radius = circle.getRadius();
BitSet expected = new BitSet();
for (int doc = 0; doc < reader.maxDoc(); doc++) {