Skip to content

Apache Lucene open-source search software

Fix test bug in TestFeatureSort.testDuelFloat.

Adrien Grandc40cd19f624d
diff --git a/lucene/core/src/java/org/apache/lucene/document/FeatureField.java b/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
index 229e0571ed3..2ca048c5270 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
@@ -197,7 +197,7 @@ public final class FeatureField extends Field {
}
}
- private static final int MAX_FREQ = Float.floatToIntBits(Float.MAX_VALUE) >>> 15;
+ static final int MAX_FREQ = Float.floatToIntBits(Float.MAX_VALUE) >>> 15;
static float decodeFeatureValue(float freq) {
if (freq > MAX_FREQ) {
diff --git a/lucene/core/src/test/org/apache/lucene/document/TestFeatureSort.java b/lucene/core/src/test/org/apache/lucene/document/TestFeatureSort.java
index 3c8fef11728..1090e5a5679 100644
--- a/lucene/core/src/test/org/apache/lucene/document/TestFeatureSort.java
+++ b/lucene/core/src/test/org/apache/lucene/document/TestFeatureSort.java
@@ -230,7 +230,7 @@ public class TestFeatureSort extends LuceneTestCase {
if (random().nextBoolean()) {
float f;
do {
- int freq = TestUtil.nextInt(random(), 1, (1 << 16) - 1);
+ int freq = TestUtil.nextInt(random(), 1, FeatureField.MAX_FREQ);
f = FeatureField.decodeFeatureValue(freq);
} while (f < Float.MIN_NORMAL);
doc.add(new NumericDocValuesField("float", Float.floatToIntBits(f)));