From 0efca23e6e5aece5fd919fc918dd3f9040c5d2f9 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Sun, 2 Aug 2015 09:45:18 +0000 Subject: [PATCH] LUCENE-6697: test bug: the stupid-simple-yet-hopefully-bug-free numeric range filter was buggy git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1693800 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/rangetree/TestRangeTree.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lucene/sandbox/src/test/org/apache/lucene/rangetree/TestRangeTree.java b/lucene/sandbox/src/test/org/apache/lucene/rangetree/TestRangeTree.java index c9035028169..e9a0154e141 100644 --- a/lucene/sandbox/src/test/org/apache/lucene/rangetree/TestRangeTree.java +++ b/lucene/sandbox/src/test/org/apache/lucene/rangetree/TestRangeTree.java @@ -402,6 +402,9 @@ public class TestRangeTree extends LuceneTestCase { } } if (random().nextBoolean()) { + if (VERBOSE) { + System.out.println(" forceMerge(1)"); + } w.forceMerge(1); } final IndexReader r = DirectoryReader.open(w, true); @@ -514,16 +517,20 @@ public class TestRangeTree extends LuceneTestCase { } private static boolean matches(long lower, boolean includeLower, long upper, boolean includeUpper, long value) { - if (value > lower && value < upper) { - return true; + if (includeLower == false) { + if (lower == Long.MAX_VALUE) { + return false; + } + lower++; } - if (value == lower && includeLower) { - return true; + if (includeUpper == false) { + if (upper == Long.MIN_VALUE) { + return false; + } + upper--; } - if (value == upper && includeUpper) { - return true; - } - return false; + + return value >= lower && value <= upper; } private static long randomValue() {