You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/03/08 23:20:30 UTC
lucene-solr git commit: fix random float test to do the +/- 1 ulp in
float space
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x d0427d861 -> acbabac7b
fix random float test to do the +/- 1 ulp in float space
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/acbabac7
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/acbabac7
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/acbabac7
Branch: refs/heads/branch_6x
Commit: acbabac7b574c792daccddfecf29f1adb3da1ec5
Parents: d0427d8
Author: Mike McCandless <mi...@apache.org>
Authored: Tue Mar 8 17:21:12 2016 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Tue Mar 8 17:21:12 2016 -0500
----------------------------------------------------------------------
.../lucene/facet/range/TestRangeFacetCounts.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/acbabac7/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
----------------------------------------------------------------------
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
index 9fde6e3..9f8b109 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
@@ -532,6 +532,8 @@ public class TestRangeFacetCounts extends FacetTestCase {
int[] expectedCounts = new int[numRange];
float minAcceptedValue = Float.POSITIVE_INFINITY;
float maxAcceptedValue = Float.NEGATIVE_INFINITY;
+ boolean[] rangeMinIncl = new boolean[numRange];
+ boolean[] rangeMaxIncl = new boolean[numRange];
if (VERBOSE) {
System.out.println("TEST: " + numRange + " ranges");
}
@@ -582,6 +584,8 @@ public class TestRangeFacetCounts extends FacetTestCase {
minIncl = random().nextBoolean();
maxIncl = random().nextBoolean();
}
+ rangeMinIncl[rangeID] = minIncl;
+ rangeMaxIncl[rangeID] = maxIncl;
ranges[rangeID] = new DoubleRange("r" + rangeID, min, minIncl, max, maxIncl);
if (VERBOSE) {
@@ -642,7 +646,17 @@ public class TestRangeFacetCounts extends FacetTestCase {
// Test drill-down:
DrillDownQuery ddq = new DrillDownQuery(config);
if (random().nextBoolean()) {
- ddq.add("field", FloatPoint.newRangeQuery("field", (float) range.min, (float) range.max));
+ // We must do the nextUp/down in float space, here, because the nextUp that DoubleRange did in double space, when cast back to float,
+ // in fact does nothing!
+ float minFloat = (float) range.min;
+ if (rangeMinIncl[rangeID] == false) {
+ minFloat = Math.nextUp(minFloat);
+ }
+ float maxFloat = (float) range.max;
+ if (rangeMaxIncl[rangeID] == false) {
+ maxFloat = Math.nextAfter(maxFloat, Float.NEGATIVE_INFINITY);
+ }
+ ddq.add("field", FloatPoint.newRangeQuery("field", minFloat, maxFloat));
} else {
ddq.add("field", range.getQuery(fastMatchQuery, vs));
}