lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r788295 - in /lucene/java/trunk/src: java/org/apache/lucene/search/NumericRangeQuery.java test/org/apache/lucene/search/TestNumericRangeQuery32.java test/org/apache/lucene/search/TestNumericRangeQuery64.java
Date Thu, 25 Jun 2009 08:51:12 GMT
Author: uschindler
Date: Thu Jun 25 08:51:12 2009
New Revision: 788295

URL: http://svn.apache.org/viewvc?rev=788295&view=rev
Log:
Enforce at least one bound != null for NumericRangeQuery to be consistent with other range
query types

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=788295&r1=788294&r2=788295&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java Thu Jun 25
08:51:12 2009
@@ -127,6 +127,8 @@
     Number min, Number max, final boolean minInclusive, final boolean maxInclusive
   ) {
     assert (valSize == 32 || valSize == 64);
+    if (min == null && max == null)
+      throw new IllegalArgumentException("At least one value must be non-null");
     if (precisionStep < 1 || precisionStep > valSize)
       throw new IllegalArgumentException("precisionStep may only be 1.."+valSize);
     this.field = field.intern();

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=788295&r1=788294&r2=788295&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Thu Jun
25 08:51:12 2009
@@ -385,7 +385,6 @@
     QueryUtils.checkHashEquals(NumericRangeQuery.newIntRange("test4", 4, new Integer(10),
new Integer(20), false, false));
     QueryUtils.checkHashEquals(NumericRangeQuery.newIntRange("test5", 4, new Integer(10),
null, true, true));
     QueryUtils.checkHashEquals(NumericRangeQuery.newIntRange("test6", 4, null, new Integer(20),
true, true));
-    QueryUtils.checkHashEquals(NumericRangeQuery.newIntRange("test7", 4, null, null, true,
true));
     QueryUtils.checkEqual(
       NumericRangeQuery.newIntRange("test8", 4, new Integer(10), new Integer(20), true, true),

       NumericRangeQuery.newIntRange("test8", 4, new Integer(10), new Integer(20), true, true)

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=788295&r1=788294&r2=788295&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Thu Jun
25 08:51:12 2009
@@ -385,7 +385,6 @@
     QueryUtils.checkHashEquals(NumericRangeQuery.newLongRange("test4", 4, new Long(10L),
new Long(20L), false, false));
     QueryUtils.checkHashEquals(NumericRangeQuery.newLongRange("test5", 4, new Long(10L),
null, true, true));
     QueryUtils.checkHashEquals(NumericRangeQuery.newLongRange("test6", 4, null, new Long(20L),
true, true));
-    QueryUtils.checkHashEquals(NumericRangeQuery.newLongRange("test7", 4, null, null, true,
true));
     QueryUtils.checkEqual(
       NumericRangeQuery.newLongRange("test8", 4, new Long(10L), new Long(20L), true, true),

       NumericRangeQuery.newLongRange("test8", 4, new Long(10L), new Long(20L), true, true)



Mime
View raw message