lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r789692 - in /lucene/java/trunk/src: java/org/apache/lucene/search/ test/org/apache/lucene/search/
Date Tue, 30 Jun 2009 12:27:51 GMT
Author: uschindler
Date: Tue Jun 30 12:27:50 2009
New Revision: 789692

URL: http://svn.apache.org/viewvc?rev=789692&view=rev
Log:
Revert revision 788295 (reenable support for null as both ends in NumericRangeQuery) and add
support for this in FieldCacheRangeFilter, too. See discussion in SOLR-940.
The strange handling of null terms (which lead me to the change) in RangeQuery will be fixed
together with LUCENE-1713.

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java
    lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.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/FieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java?rev=789692&r1=789691&r2=789692&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java Tue Jun
30 12:27:50 2009
@@ -61,8 +61,6 @@
   final boolean includeUpper;
   
   private FieldCacheRangeFilter(String field, FieldCache.Parser parser, Object lowerVal,
Object upperVal, boolean includeLower, boolean includeUpper) {
-    if (lowerVal == null && upperVal == null)
-      throw new IllegalArgumentException("At least one value must be non-null");
     this.field = field;
     this.parser = parser;
     this.lowerVal = lowerVal;

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=789692&r1=789691&r2=789692&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 Tue Jun 30
12:27:50 2009
@@ -127,8 +127,6 @@
     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/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=789692&r1=789691&r2=789692&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Tue
Jun 30 12:27:50 2009
@@ -87,6 +87,9 @@
 
     // unbounded id
 
+    result = search.search(q,FieldCacheRangeFilter.newStringRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
+
     result = search.search(q,FieldCacheRangeFilter.newStringRange("id",minIP,null,T,F), numDocs).scoreDocs;
     assertEquals("min and up", numDocs, result.length);
 
@@ -230,6 +233,9 @@
     
     // unbounded id
 
+    result = search.search(q,FieldCacheRangeFilter.newShortRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
+
     result = search.search(q,FieldCacheRangeFilter.newShortRange("id",minIdO,null,T,F), numDocs).scoreDocs;
     assertEquals("min and up", numDocs, result.length);
 
@@ -317,6 +323,9 @@
     
     // unbounded id
 
+    result = search.search(q,FieldCacheRangeFilter.newIntRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
+
     result = search.search(q,FieldCacheRangeFilter.newIntRange("id",minIdO,null,T,F), numDocs).scoreDocs;
     assertEquals("min and up", numDocs, result.length);
 
@@ -404,6 +413,9 @@
     
     // unbounded id
 
+    result = search.search(q,FieldCacheRangeFilter.newLongRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
+
     result = search.search(q,FieldCacheRangeFilter.newLongRange("id",minIdO,null,T,F), numDocs).scoreDocs;
     assertEquals("min and up", numDocs, result.length);
 
@@ -475,6 +487,8 @@
     result = search.search(q,FieldCacheRangeFilter.newFloatRange("id",medIdO,null,F,F), numDocs).scoreDocs;
     count += result.length;
     assertEquals("sum of two concenatted ranges", numDocs, count);
+    result = search.search(q,FieldCacheRangeFilter.newFloatRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
     result = search.search(q,FieldCacheRangeFilter.newFloatRange("id",new Float(Float.POSITIVE_INFINITY),null,F,F),
numDocs).scoreDocs;
     assertEquals("infinity special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newFloatRange("id",null,new Float(Float.NEGATIVE_INFINITY),F,F),
numDocs).scoreDocs;
@@ -501,6 +515,8 @@
     result = search.search(q,FieldCacheRangeFilter.newDoubleRange("id",medIdO,null,F,F),
numDocs).scoreDocs;
     count += result.length;
     assertEquals("sum of two concenatted ranges", numDocs, count);
+    result = search.search(q,FieldCacheRangeFilter.newDoubleRange("id",null,null,T,T), numDocs).scoreDocs;
+    assertEquals("find all", numDocs, result.length);
     result = search.search(q,FieldCacheRangeFilter.newDoubleRange("id",new Double(Double.POSITIVE_INFINITY),null,F,F),
numDocs).scoreDocs;
     assertEquals("infinity special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newDoubleRange("id",null, new Double(Double.NEGATIVE_INFINITY),F,F),
numDocs).scoreDocs;

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=789692&r1=789691&r2=789692&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 Tue Jun
30 12:27:50 2009
@@ -391,6 +391,7 @@
     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=789692&r1=789691&r2=789692&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 Tue Jun
30 12:27:50 2009
@@ -391,6 +391,7 @@
     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