lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r770602 - in /lucene/java/trunk/contrib/queries/src: java/org/apache/lucene/search/trie/TrieUtils.java test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java
Date Fri, 01 May 2009 09:55:01 GMT
Author: uschindler
Date: Fri May  1 09:55:01 2009
New Revision: 770602

URL: http://svn.apache.org/viewvc?rev=770602&view=rev
Log:
Correct JavaDocs in TrieUtils. This also adds a missing test for equals() and hashcode() of
the TrieRangeQueries.

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieUtils.java
    lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java
    lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieUtils.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieUtils.java?rev=770602&r1=770601&r2=770602&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieUtils.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieUtils.java
Fri May  1 09:55:01 2009
@@ -305,7 +305,7 @@
    * {@link org.apache.lucene.search.BooleanQuery} for each call to its
    * {@link LongRangeBuilder#addRange(String,String)}
    * method.
-   * <p>This method is used by {@link LongTrieRangeFilter}.
+   * <p>This method is used by {@link LongTrieRangeQuery}.
    */
   public static void splitLongRange(final LongRangeBuilder builder,
     final int precisionStep,  final long minBound, final long maxBound
@@ -321,7 +321,7 @@
    * {@link org.apache.lucene.search.BooleanQuery} for each call to its
    * {@link IntRangeBuilder#addRange(String,String)}
    * method.
-   * <p>This method is used by {@link IntTrieRangeFilter}.
+   * <p>This method is used by {@link IntTrieRangeQuery}.
    */
   public static void splitIntRange(final IntRangeBuilder builder,
     final int precisionStep,  final int minBound, final int maxBound

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java?rev=770602&r1=770601&r2=770602&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java
(original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieRangeQuery.java
Fri May  1 09:55:01 2009
@@ -34,6 +34,7 @@
 import org.apache.lucene.search.RangeQuery;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.QueryUtils;
 import org.apache.lucene.util.LuceneTestCase;
 
 public class TestIntTrieRangeQuery extends LuceneTestCase {
@@ -368,4 +369,34 @@
     testSorting(2);
   }
   
+  public void testEqualsAndHash() throws Exception {
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test1", 4, new Integer(10), new Integer(20),
true, true));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test2", 4, new Integer(10), new Integer(20),
false, true));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test3", 4, new Integer(10), new Integer(20),
true, false));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test4", 4, new Integer(10), new Integer(20),
false, false));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test5", 4, new Integer(10), null, true,
true));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test6", 4, null, new Integer(20), true,
true));
+    QueryUtils.checkHashEquals(new IntTrieRangeQuery("test7", 4, null, null, true, true));
+    QueryUtils.checkEqual(
+      new IntTrieRangeQuery("test8", 4, new Integer(10), new Integer(20), true, true), 
+      new IntTrieRangeQuery("test8", 4, new Integer(10), new Integer(20), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new IntTrieRangeQuery("test9", 4, new Integer(10), new Integer(20), true, true), 
+      new IntTrieRangeQuery("test9", 8, new Integer(10), new Integer(20), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new IntTrieRangeQuery("test10a", 4, new Integer(10), new Integer(20), true, true),

+      new IntTrieRangeQuery("test10b", 4, new Integer(10), new Integer(20), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new IntTrieRangeQuery("test11", 4, new Integer(10), new Integer(20), true, true), 
+      new IntTrieRangeQuery("test11", 4, new Integer(20), new Integer(10), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new IntTrieRangeQuery("test12", 4, new Integer(10), new Integer(20), true, true), 
+      new IntTrieRangeQuery("test12", 4, new Integer(10), new Integer(20), false, true)
+     );
+  }
+  
 }

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java?rev=770602&r1=770601&r2=770602&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java
(original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieRangeQuery.java
Fri May  1 09:55:01 2009
@@ -34,6 +34,7 @@
 import org.apache.lucene.search.RangeQuery;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.QueryUtils;
 import org.apache.lucene.util.LuceneTestCase;
 
 public class TestLongTrieRangeQuery extends LuceneTestCase {
@@ -368,4 +369,34 @@
     testSorting(2);
   }
   
+  public void testEqualsAndHash() throws Exception {
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test1", 4, new Long(10L), new Long(20L),
true, true));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test2", 4, new Long(10L), new Long(20L),
false, true));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test3", 4, new Long(10L), new Long(20L),
true, false));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test4", 4, new Long(10L), new Long(20L),
false, false));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test5", 4, new Long(10L), null, true,
true));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test6", 4, null, new Long(20L), true,
true));
+    QueryUtils.checkHashEquals(new LongTrieRangeQuery("test7", 4, null, null, true, true));
+    QueryUtils.checkEqual(
+      new LongTrieRangeQuery("test8", 4, new Long(10L), new Long(20L), true, true), 
+      new LongTrieRangeQuery("test8", 4, new Long(10L), new Long(20L), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new LongTrieRangeQuery("test9", 4, new Long(10L), new Long(20L), true, true), 
+      new LongTrieRangeQuery("test9", 8, new Long(10L), new Long(20L), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new LongTrieRangeQuery("test10a", 4, new Long(10L), new Long(20L), true, true), 
+      new LongTrieRangeQuery("test10b", 4, new Long(10L), new Long(20L), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new LongTrieRangeQuery("test11", 4, new Long(10L), new Long(20L), true, true), 
+      new LongTrieRangeQuery("test11", 4, new Long(20L), new Long(10L), true, true)
+     );
+    QueryUtils.checkUnequal(
+      new LongTrieRangeQuery("test12", 4, new Long(10L), new Long(20L), true, true), 
+      new LongTrieRangeQuery("test12", 4, new Long(10L), new Long(20L), false, true)
+     );
+  }
+  
 }



Mime
View raw message