mirror of https://github.com/apache/lucene.git
SOLR-11345: restrict double field values used for function queries to float range
This commit is contained in:
parent
cd425d609c
commit
5f68eb9456
|
@ -3330,7 +3330,14 @@ public class TestPointFields extends SolrTestCaseJ4 {
|
||||||
private void doTestDoublePointFunctionQuery(String field) throws Exception {
|
private void doTestDoublePointFunctionQuery(String field) throws Exception {
|
||||||
assertTrue(h.getCore().getLatestSchema().getField(field).getType() instanceof PointField);
|
assertTrue(h.getCore().getLatestSchema().getField(field).getType() instanceof PointField);
|
||||||
int numVals = 10 * RANDOM_MULTIPLIER;
|
int numVals = 10 * RANDOM_MULTIPLIER;
|
||||||
List<Double> values = getRandomDoubles(numVals, false);
|
// Restrict values to float range; otherwise conversion to float will cause truncation -> undefined results
|
||||||
|
List<Double> values = getRandomList(10, false, () -> {
|
||||||
|
Float f = Float.NaN;
|
||||||
|
while (f.isNaN()) {
|
||||||
|
f = Float.intBitsToFloat(random().nextInt());
|
||||||
|
}
|
||||||
|
return f.doubleValue();
|
||||||
|
});
|
||||||
String assertNumFound = "//*[@numFound='" + numVals + "']";
|
String assertNumFound = "//*[@numFound='" + numVals + "']";
|
||||||
String[] idAscXpathChecks = new String[numVals + 1];
|
String[] idAscXpathChecks = new String[numVals + 1];
|
||||||
String[] idAscNegXpathChecks = new String[numVals + 1];
|
String[] idAscNegXpathChecks = new String[numVals + 1];
|
||||||
|
|
Loading…
Reference in New Issue