mirror of https://github.com/apache/lucene.git
Correct JavaDocs in TrieUtils. This also adds a missing test for equals() and hashcode() of the TrieRangeQueries.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@770602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9620458453
commit
673b90e651
|
@ -305,7 +305,7 @@ public final class TrieUtils {
|
|||
* {@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 @@ public final class TrieUtils {
|
|||
* {@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
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.lucene.search.DocIdSet;
|
|||
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 @@ public class TestIntTrieRangeQuery extends LuceneTestCase {
|
|||
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)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.lucene.search.DocIdSet;
|
|||
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 @@ public class TestLongTrieRangeQuery extends LuceneTestCase {
|
|||
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)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue