lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r791175 [2/2] - in /lucene/java/trunk: ./ contrib/collation/src/test/org/apache/lucene/collation/ contrib/highlighter/src/java/org/apache/lucene/search/highlight/ contrib/highlighter/src/test/org/apache/lucene/search/highlight/ contrib/misc...
Date Sat, 04 Jul 2009 20:14:13 GMT
Copied: lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeFilter.java (from
r790584, lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeFilter.java)
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeFilter.java?p2=lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeFilter.java&p1=lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeFilter.java&r1=790584&r2=791175&rev=791175&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeFilter.java Sat Jul 
4 20:14:12 2009
@@ -30,7 +30,7 @@
 import org.apache.lucene.store.RAMDirectory;
 
 /**
- * A basic 'positive' Unit test class for the RangeFilter class.
+ * A basic 'positive' Unit test class for the TermRangeFilter class.
  *
  * <p>
  * NOTE: at the moment, this class only tests for 'positive' results,
@@ -38,12 +38,12 @@
  * nor does it adequately test 'negative' results.  It also does not test
  * that garbage in results in an Exception.
  */
-public class TestRangeFilter extends BaseTestRangeFilter {
+public class TestTermRangeFilter extends BaseTestRangeFilter {
 
-    public TestRangeFilter(String name) {
+    public TestTermRangeFilter(String name) {
 	super(name);
     }
-    public TestRangeFilter() {
+    public TestTermRangeFilter() {
         super();
     }
 
@@ -67,64 +67,64 @@
 
         // test id, bounded on both ends
         
-  result = search.search(q,new RangeFilter("id",minIP,maxIP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,maxIP,T,T), numDocs).scoreDocs;
   assertEquals("find all", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("id",minIP,maxIP,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,maxIP,T,F), numDocs).scoreDocs;
   assertEquals("all but last", numDocs-1, result.length);
 
-  result = search.search(q,new RangeFilter("id",minIP,maxIP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,maxIP,F,T), numDocs).scoreDocs;
   assertEquals("all but first", numDocs-1, result.length);
         
-  result = search.search(q,new RangeFilter("id",minIP,maxIP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,maxIP,F,F), numDocs).scoreDocs;
         assertEquals("all but ends", numDocs-2, result.length);
     
-        result = search.search(q,new RangeFilter("id",medIP,maxIP,T,T), numDocs).scoreDocs;
+        result = search.search(q,new TermRangeFilter("id",medIP,maxIP,T,T), numDocs).scoreDocs;
         assertEquals("med and up", 1+ maxId-medId, result.length);
         
-        result = search.search(q,new RangeFilter("id",minIP,medIP,T,T), numDocs).scoreDocs;
+        result = search.search(q,new TermRangeFilter("id",minIP,medIP,T,T), numDocs).scoreDocs;
         assertEquals("up to med", 1+ medId-minId, result.length);
 
         // unbounded id
 
-  result = search.search(q,new RangeFilter("id",minIP,null,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,null,T,F), numDocs).scoreDocs;
   assertEquals("min and up", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("id",null,maxIP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",null,maxIP,F,T), numDocs).scoreDocs;
   assertEquals("max and down", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("id",minIP,null,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,null,F,F), numDocs).scoreDocs;
   assertEquals("not min, but up", numDocs-1, result.length);
         
-  result = search.search(q,new RangeFilter("id",null,maxIP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",null,maxIP,F,F), numDocs).scoreDocs;
   assertEquals("not max, but down", numDocs-1, result.length);
         
-        result = search.search(q,new RangeFilter("id",medIP,maxIP,T,F), numDocs).scoreDocs;
+        result = search.search(q,new TermRangeFilter("id",medIP,maxIP,T,F), numDocs).scoreDocs;
         assertEquals("med and up, not max", maxId-medId, result.length);
         
-        result = search.search(q,new RangeFilter("id",minIP,medIP,F,T), numDocs).scoreDocs;
+        result = search.search(q,new TermRangeFilter("id",minIP,medIP,F,T), numDocs).scoreDocs;
         assertEquals("not min, up to med", medId-minId, result.length);
 
         // very small sets
 
-  result = search.search(q,new RangeFilter("id",minIP,minIP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,minIP,F,F), numDocs).scoreDocs;
   assertEquals("min,min,F,F", 0, result.length);
-  result = search.search(q,new RangeFilter("id",medIP,medIP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",medIP,medIP,F,F), numDocs).scoreDocs;
   assertEquals("med,med,F,F", 0, result.length);
-  result = search.search(q,new RangeFilter("id",maxIP,maxIP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",maxIP,maxIP,F,F), numDocs).scoreDocs;
   assertEquals("max,max,F,F", 0, result.length);
                      
-  result = search.search(q,new RangeFilter("id",minIP,minIP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",minIP,minIP,T,T), numDocs).scoreDocs;
   assertEquals("min,min,T,T", 1, result.length);
-  result = search.search(q,new RangeFilter("id",null,minIP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",null,minIP,F,T), numDocs).scoreDocs;
   assertEquals("nul,min,F,T", 1, result.length);
 
-  result = search.search(q,new RangeFilter("id",maxIP,maxIP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",maxIP,maxIP,T,T), numDocs).scoreDocs;
   assertEquals("max,max,T,T", 1, result.length);
-  result = search.search(q,new RangeFilter("id",maxIP,null,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",maxIP,null,T,F), numDocs).scoreDocs;
   assertEquals("max,nul,T,T", 1, result.length);
 
-  result = search.search(q,new RangeFilter("id",medIP,medIP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("id",medIP,medIP,T,T), numDocs).scoreDocs;
   assertEquals("med,med,T,T", 1, result.length);
         
     }
@@ -151,64 +151,64 @@
 
         // test id, bounded on both ends
 
-        result = search.search(q,new RangeFilter("id",minIP,maxIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,maxIP,T,T,c));
         assertEquals("find all", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,maxIP,T,F,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,maxIP,T,F,c));
         assertEquals("all but last", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,maxIP,F,T,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,maxIP,F,T,c));
         assertEquals("all but first", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,maxIP,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,maxIP,F,F,c));
         assertEquals("all but ends", numDocs-2, result.length());
 
-        result = search.search(q,new RangeFilter("id",medIP,maxIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",medIP,maxIP,T,T,c));
         assertEquals("med and up", 1+ maxId-medId, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,medIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,medIP,T,T,c));
         assertEquals("up to med", 1+ medId-minId, result.length());
 
         // unbounded id
 
-        result = search.search(q,new RangeFilter("id",minIP,null,T,F,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,null,T,F,c));
         assertEquals("min and up", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("id",null,maxIP,F,T,c));
+        result = search.search(q,new TermRangeFilter("id",null,maxIP,F,T,c));
         assertEquals("max and down", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,null,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,null,F,F,c));
         assertEquals("not min, but up", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("id",null,maxIP,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",null,maxIP,F,F,c));
         assertEquals("not max, but down", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("id",medIP,maxIP,T,F,c));
+        result = search.search(q,new TermRangeFilter("id",medIP,maxIP,T,F,c));
         assertEquals("med and up, not max", maxId-medId, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,medIP,F,T,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,medIP,F,T,c));
         assertEquals("not min, up to med", medId-minId, result.length());
 
         // very small sets
 
-        result = search.search(q,new RangeFilter("id",minIP,minIP,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,minIP,F,F,c));
         assertEquals("min,min,F,F", 0, result.length());
-        result = search.search(q,new RangeFilter("id",medIP,medIP,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",medIP,medIP,F,F,c));
         assertEquals("med,med,F,F", 0, result.length());
-        result = search.search(q,new RangeFilter("id",maxIP,maxIP,F,F,c));
+        result = search.search(q,new TermRangeFilter("id",maxIP,maxIP,F,F,c));
         assertEquals("max,max,F,F", 0, result.length());
 
-        result = search.search(q,new RangeFilter("id",minIP,minIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",minIP,minIP,T,T,c));
         assertEquals("min,min,T,T", 1, result.length());
-        result = search.search(q,new RangeFilter("id",null,minIP,F,T,c));
+        result = search.search(q,new TermRangeFilter("id",null,minIP,F,T,c));
         assertEquals("nul,min,F,T", 1, result.length());
 
-        result = search.search(q,new RangeFilter("id",maxIP,maxIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",maxIP,maxIP,T,T,c));
         assertEquals("max,max,T,T", 1, result.length());
-        result = search.search(q,new RangeFilter("id",maxIP,null,T,F,c));
+        result = search.search(q,new TermRangeFilter("id",maxIP,null,T,F,c));
         assertEquals("max,nul,T,T", 1, result.length());
 
-        result = search.search(q,new RangeFilter("id",medIP,medIP,T,T,c));
+        result = search.search(q,new TermRangeFilter("id",medIP,medIP,T,T,c));
         assertEquals("med,med,T,T", 1, result.length());
     }
 
@@ -229,47 +229,47 @@
 
         // test extremes, bounded on both ends
         
-  result = search.search(q,new RangeFilter("rand",minRP,maxRP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,T,T), numDocs).scoreDocs;
   assertEquals("find all", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("rand",minRP,maxRP,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,T,F), numDocs).scoreDocs;
   assertEquals("all but biggest", numDocs-1, result.length);
 
-  result = search.search(q,new RangeFilter("rand",minRP,maxRP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,F,T), numDocs).scoreDocs;
   assertEquals("all but smallest", numDocs-1, result.length);
         
-  result = search.search(q,new RangeFilter("rand",minRP,maxRP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,F,F), numDocs).scoreDocs;
         assertEquals("all but extremes", numDocs-2, result.length);
     
         // unbounded
 
-  result = search.search(q,new RangeFilter("rand",minRP,null,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,null,T,F), numDocs).scoreDocs;
   assertEquals("smallest and up", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("rand",null,maxRP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",null,maxRP,F,T), numDocs).scoreDocs;
   assertEquals("biggest and down", numDocs, result.length);
 
-  result = search.search(q,new RangeFilter("rand",minRP,null,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,null,F,F), numDocs).scoreDocs;
   assertEquals("not smallest, but up", numDocs-1, result.length);
         
-  result = search.search(q,new RangeFilter("rand",null,maxRP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",null,maxRP,F,F), numDocs).scoreDocs;
   assertEquals("not biggest, but down", numDocs-1, result.length);
         
         // very small sets
 
-  result = search.search(q,new RangeFilter("rand",minRP,minRP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,minRP,F,F), numDocs).scoreDocs;
   assertEquals("min,min,F,F", 0, result.length);
-  result = search.search(q,new RangeFilter("rand",maxRP,maxRP,F,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",maxRP,maxRP,F,F), numDocs).scoreDocs;
   assertEquals("max,max,F,F", 0, result.length);
                      
-  result = search.search(q,new RangeFilter("rand",minRP,minRP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",minRP,minRP,T,T), numDocs).scoreDocs;
   assertEquals("min,min,T,T", 1, result.length);
-  result = search.search(q,new RangeFilter("rand",null,minRP,F,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",null,minRP,F,T), numDocs).scoreDocs;
   assertEquals("nul,min,F,T", 1, result.length);
 
-  result = search.search(q,new RangeFilter("rand",maxRP,maxRP,T,T), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",maxRP,maxRP,T,T), numDocs).scoreDocs;
   assertEquals("max,max,T,T", 1, result.length);
-  result = search.search(q,new RangeFilter("rand",maxRP,null,T,F), numDocs).scoreDocs;
+  result = search.search(q,new TermRangeFilter("rand",maxRP,null,T,F), numDocs).scoreDocs;
   assertEquals("max,nul,T,T", 1, result.length);
         
     }
@@ -294,47 +294,47 @@
 
         // test extremes, bounded on both ends
 
-        result = search.search(q,new RangeFilter("rand",minRP,maxRP,T,T,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,T,T,c));
         assertEquals("find all", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("rand",minRP,maxRP,T,F,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,T,F,c));
         assertEquals("all but biggest", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("rand",minRP,maxRP,F,T,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,F,T,c));
         assertEquals("all but smallest", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("rand",minRP,maxRP,F,F,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,maxRP,F,F,c));
         assertEquals("all but extremes", numDocs-2, result.length());
 
         // unbounded
 
-        result = search.search(q,new RangeFilter("rand",minRP,null,T,F,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,null,T,F,c));
         assertEquals("smallest and up", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("rand",null,maxRP,F,T,c));
+        result = search.search(q,new TermRangeFilter("rand",null,maxRP,F,T,c));
         assertEquals("biggest and down", numDocs, result.length());
 
-        result = search.search(q,new RangeFilter("rand",minRP,null,F,F,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,null,F,F,c));
         assertEquals("not smallest, but up", numDocs-1, result.length());
 
-        result = search.search(q,new RangeFilter("rand",null,maxRP,F,F,c));
+        result = search.search(q,new TermRangeFilter("rand",null,maxRP,F,F,c));
         assertEquals("not biggest, but down", numDocs-1, result.length());
 
         // very small sets
 
-        result = search.search(q,new RangeFilter("rand",minRP,minRP,F,F,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,minRP,F,F,c));
         assertEquals("min,min,F,F", 0, result.length());
-        result = search.search(q,new RangeFilter("rand",maxRP,maxRP,F,F,c));
+        result = search.search(q,new TermRangeFilter("rand",maxRP,maxRP,F,F,c));
         assertEquals("max,max,F,F", 0, result.length());
 
-        result = search.search(q,new RangeFilter("rand",minRP,minRP,T,T,c));
+        result = search.search(q,new TermRangeFilter("rand",minRP,minRP,T,T,c));
         assertEquals("min,min,T,T", 1, result.length());
-        result = search.search(q,new RangeFilter("rand",null,minRP,F,T,c));
+        result = search.search(q,new TermRangeFilter("rand",null,minRP,F,T,c));
         assertEquals("nul,min,F,T", 1, result.length());
 
-        result = search.search(q,new RangeFilter("rand",maxRP,maxRP,T,T,c));
+        result = search.search(q,new TermRangeFilter("rand",maxRP,maxRP,T,T,c));
         assertEquals("max,max,T,T", 1, result.length());
-        result = search.search(q,new RangeFilter("rand",maxRP,null,T,F,c));
+        result = search.search(q,new TermRangeFilter("rand",maxRP,null,T,F,c));
         assertEquals("max,nul,T,T", 1, result.length());
     }
     
@@ -365,14 +365,14 @@
         
         // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
         // orders the U+0698 character before the U+0633 character, so the single
-        // index Term below should NOT be returned by a RangeFilter with a Farsi
+        // index Term below should NOT be returned by a TermRangeFilter with a Farsi
         // Collator (or an Arabic one for the case when Farsi is not supported).
         Hits result = search.search
-            (q, new RangeFilter("content", "\u062F", "\u0698", T, T, collator));
+            (q, new TermRangeFilter("content", "\u062F", "\u0698", T, T, collator));
         assertEquals("The index Term should not be included.", 0, result.length());
 
         result = search.search
-            (q, new RangeFilter("content", "\u0633", "\u0638", T, T, collator));
+            (q, new TermRangeFilter("content", "\u0633", "\u0638", T, T, collator));
         assertEquals("The index Term should be included.", 1, result.length());
         search.close();
     }
@@ -403,17 +403,17 @@
         Query q = new TermQuery(new Term("body","body"));
 
         Collator collator = Collator.getInstance(new Locale("da", "dk"));
-        Query query = new RangeQuery
+        Query query = new TermRangeQuery
             ("content", "H\u00D8T", "MAND", false, false, collator);
 
         // Unicode order would not include "H\u00C5T" in [ "H\u00D8T", "MAND" ],
         // but Danish collation does.
         Hits result = search.search
-            (q, new RangeFilter("content", "H\u00D8T", "MAND", F, F, collator));
+            (q, new TermRangeFilter("content", "H\u00D8T", "MAND", F, F, collator));
         assertEquals("The index Term should be included.", 1, result.length());
 
         result = search.search
-            (q, new RangeFilter("content", "H\u00C5T", "MAND", F, F, collator));
+            (q, new TermRangeFilter("content", "H\u00C5T", "MAND", F, F, collator));
         assertEquals
             ("The index Term should not be included.", 0, result.length());
         search.close();

Copied: lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java (from
r790584, lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeQuery.java)
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java?p2=lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java&p1=lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeQuery.java&r1=790584&r2=791175&rev=791175&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java Sat Jul  4
20:14:12 2009
@@ -35,7 +35,7 @@
 import java.text.Collator;
 
 
-public class TestRangeQuery extends LuceneTestCase {
+public class TestTermRangeQuery extends LuceneTestCase {
 
   private int docCount = 0;
   private RAMDirectory dir;
@@ -46,7 +46,7 @@
   }
 
   public void testExclusive() throws Exception {
-    Query query = new RangeQuery("content", "A", "C", false, false);
+    Query query = new TermRangeQuery("content", "A", "C", false, false);
     initializeIndex(new String[] {"A", "B", "C", "D"});
     IndexSearcher searcher = new IndexSearcher(dir);
     ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
@@ -84,7 +84,7 @@
   }
 
   public void testInclusive() throws Exception {
-    Query query = new RangeQuery("content", "A", "C", true, true);
+    Query query = new TermRangeQuery("content", "A", "C", true, true);
 
     initializeIndex(new String[]{"A", "B", "C", "D"});
     IndexSearcher searcher = new IndexSearcher(dir);
@@ -106,10 +106,10 @@
   }
 
   public void testEqualsHashcode() {
-    Query query = new RangeQuery("content", "A", "C", true, true);
+    Query query = new TermRangeQuery("content", "A", "C", true, true);
     
     query.setBoost(1.0f);
-    Query other = new RangeQuery("content", "A", "C", true, true);
+    Query other = new TermRangeQuery("content", "A", "C", true, true);
     other.setBoost(1.0f);
 
     assertEquals("query equals itself is true", query, query);
@@ -119,40 +119,40 @@
     other.setBoost(2.0f);
     assertFalse("Different boost queries are not equal", query.equals(other));
 
-    other = new RangeQuery("notcontent", "A", "C", true, true);
+    other = new TermRangeQuery("notcontent", "A", "C", true, true);
     assertFalse("Different fields are not equal", query.equals(other));
 
-    other = new RangeQuery("content", "X", "C", true, true);
+    other = new TermRangeQuery("content", "X", "C", true, true);
     assertFalse("Different lower terms are not equal", query.equals(other));
 
-    other = new RangeQuery("content", "A", "Z", true, true);
+    other = new TermRangeQuery("content", "A", "Z", true, true);
     assertFalse("Different upper terms are not equal", query.equals(other));
 
-    query = new RangeQuery("content", null, "C", true, true);
-    other = new RangeQuery("content", null, "C", true, true);
+    query = new TermRangeQuery("content", null, "C", true, true);
+    other = new TermRangeQuery("content", null, "C", true, true);
     assertEquals("equivalent queries with null lowerterms are equal()", query, other);
     assertEquals("hashcode must return same value when equals is true", query.hashCode(),
other.hashCode());
 
-    query = new RangeQuery("content", "C", null, true, true);
-    other = new RangeQuery("content", "C", null, true, true);
+    query = new TermRangeQuery("content", "C", null, true, true);
+    other = new TermRangeQuery("content", "C", null, true, true);
     assertEquals("equivalent queries with null upperterms are equal()", query, other);
     assertEquals("hashcode returns same value", query.hashCode(), other.hashCode());
 
-    query = new RangeQuery("content", null, "C", true, true);
-    other = new RangeQuery("content", "C", null, true, true);
+    query = new TermRangeQuery("content", null, "C", true, true);
+    other = new TermRangeQuery("content", "C", null, true, true);
     assertFalse("queries with different upper and lower terms are not equal", query.equals(other));
 
-    query = new RangeQuery("content", "A", "C", false, false);
-    other = new RangeQuery("content", "A", "C", true, true);
+    query = new TermRangeQuery("content", "A", "C", false, false);
+    other = new TermRangeQuery("content", "A", "C", true, true);
     assertFalse("queries with different inclusive are not equal", query.equals(other));
     
-    query = new RangeQuery("content", "A", "C", false, false);
-    other = new RangeQuery("content", "A", "C", false, false, Collator.getInstance());
+    query = new TermRangeQuery("content", "A", "C", false, false);
+    other = new TermRangeQuery("content", "A", "C", false, false, Collator.getInstance());
     assertFalse("a query with a collator is not equal to one without", query.equals(other));
   }
 
   public void testExclusiveCollating() throws Exception {
-    Query query = new RangeQuery("content", "A", "C", false, false, Collator.getInstance(Locale.ENGLISH));
+    Query query = new TermRangeQuery("content", "A", "C", false, false, Collator.getInstance(Locale.ENGLISH));
     initializeIndex(new String[] {"A", "B", "C", "D"});
     IndexSearcher searcher = new IndexSearcher(dir);
     ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
@@ -173,7 +173,7 @@
   }
 
   public void testInclusiveCollating() throws Exception {
-    Query query = new RangeQuery("content", "A", "C",true, true, Collator.getInstance(Locale.ENGLISH));
+    Query query = new TermRangeQuery("content", "A", "C",true, true, Collator.getInstance(Locale.ENGLISH));
 
     initializeIndex(new String[]{"A", "B", "C", "D"});
     IndexSearcher searcher = new IndexSearcher(dir);
@@ -199,17 +199,17 @@
     // RuleBasedCollator.  However, the Arabic Locale seems to order the Farsi
     // characters properly.
     Collator collator = Collator.getInstance(new Locale("ar"));
-    Query query = new RangeQuery("content", "\u062F", "\u0698", true, true, collator);
+    Query query = new TermRangeQuery("content", "\u062F", "\u0698", true, true, collator);
     // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
     // orders the U+0698 character before the U+0633 character, so the single
-    // index Term below should NOT be returned by a RangeQuery with a Farsi
+    // index Term below should NOT be returned by a TermRangeQuery with a Farsi
     // Collator (or an Arabic one for the case when Farsi is not supported).
     initializeIndex(new String[]{ "\u0633\u0627\u0628"});
     IndexSearcher searcher = new IndexSearcher(dir);
     ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("The index Term should not be included.", 0, hits.length);
 
-    query = new RangeQuery("content", "\u0633", "\u0638",true, true, collator);
+    query = new TermRangeQuery("content", "\u0633", "\u0638",true, true, collator);
     hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("The index Term should be included.", 1, hits.length);
     searcher.close();
@@ -220,7 +220,7 @@
     // Danish collation orders the words below in the given order (example taken
     // from TestSort.testInternationalSort() ).
     String[] words = { "H\u00D8T", "H\u00C5T", "MAND" };
-    Query query = new RangeQuery("content", "H\u00D8T", "MAND", false, false, collator);
+    Query query = new TermRangeQuery("content", "H\u00D8T", "MAND", false, false, collator);
 
     // Unicode order would not include "H\u00C5T" in [ "H\u00D8T", "MAND" ],
     // but Danish collation does.
@@ -229,7 +229,7 @@
     ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("The index Term should be included.", 1, hits.length);
 
-    query = new RangeQuery("content", "H\u00C5T", "MAND", false, false, collator);
+    query = new TermRangeQuery("content", "H\u00C5T", "MAND", false, false, collator);
     hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("The index Term should not be included.", 0, hits.length);
     searcher.close();
@@ -315,9 +315,8 @@
   public void testExclusiveLowerNull() throws Exception {
     Analyzer analyzer = new SingleCharAnalyzer();
     //http://issues.apache.org/jira/browse/LUCENE-38
-    Query query = new RangeQuery(null,
-                                 new Term("content", "C"),
-                                 false);
+    Query query = new TermRangeQuery("content", null, "C",
+                                 false, false);
     initializeIndex(new String[] {"A", "B", "", "C", "D"}, analyzer);
     IndexSearcher searcher = new IndexSearcher(dir);
     Hits hits = searcher.search(query);
@@ -349,9 +348,7 @@
   public void testInclusiveLowerNull() throws Exception {
     //http://issues.apache.org/jira/browse/LUCENE-38
     Analyzer analyzer = new SingleCharAnalyzer();
-    Query query = new RangeQuery(null,
-                                 new Term("content", "C"),
-                                 true);
+    Query query = new TermRangeQuery("content", null, "C", true, true);
     initializeIndex(new String[]{"A", "B", "","C", "D"}, analyzer);
     IndexSearcher searcher = new IndexSearcher(dir);
     Hits hits = searcher.search(query);



Mime
View raw message