From 5ba87f9efa8f262070bf3b46dda9263570f62b61 Mon Sep 17 00:00:00 2001 From: Ignacio Vera Date: Mon, 13 Dec 2021 12:01:20 +0100 Subject: [PATCH] LUCENE-10310: Fix test error in TestXYDocValuesQueries#testRandomDistanceHuge (#537) We create random circles using ShapeTestUtils which is safe. --- lucene/CHANGES.txt | 3 +++ .../java/org/apache/lucene/geo/BaseXYPointTestCase.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 59f1cc3838d..fdc91f7bcf8 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -79,6 +79,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++) {