SOLR-11345: restrict double field values used for function queries to float range

This commit is contained in:
Steve Rowe 2017-09-11 10:08:01 -04:00
parent cd425d609c
commit 5f68eb9456
1 changed files with 8 additions and 1 deletions

View File

@ -3330,7 +3330,14 @@ public class TestPointFields extends SolrTestCaseJ4 {
private void doTestDoublePointFunctionQuery(String field) throws Exception {
assertTrue(h.getCore().getLatestSchema().getField(field).getType() instanceof PointField);
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[] idAscXpathChecks = new String[numVals + 1];
String[] idAscNegXpathChecks = new String[numVals + 1];