mirror of https://github.com/apache/lucene.git
Fix test bug in TestFeatureSort.testDuelFloat.
It could index out-of-range frequencies.
This commit is contained in:
parent
7d4751e8b8
commit
f3c50f966a
|
@ -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) {
|
||||
|
|
|
@ -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)));
|
||||
|
|
Loading…
Reference in New Issue