lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject [21/31] lucene-solr:jira/http2: LUCENE-8464: Fix legacy.TestMultiValuedNumericRangeQuery to count the number of hits accurately
Date Tue, 20 Nov 2018 15:16:31 GMT
LUCENE-8464: Fix legacy.TestMultiValuedNumericRangeQuery to count the number of hits accurately


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/759af012
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/759af012
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/759af012

Branch: refs/heads/jira/http2
Commit: 759af0127cb1d12a89162361f6377a71774254dc
Parents: a0788a7
Author: Jim Ferenczi <jimczi@apache.org>
Authored: Mon Nov 19 09:42:48 2018 +0100
Committer: Jim Ferenczi <jimczi@apache.org>
Committed: Mon Nov 19 09:42:48 2018 +0100

----------------------------------------------------------------------
 .../solr/legacy/TestMultiValuedNumericRangeQuery.java       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/759af012/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
b/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
index d9642a2..48da62c 100644
--- a/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
+++ b/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
@@ -29,6 +29,7 @@ import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -71,8 +72,12 @@ public class TestMultiValuedNumericRangeQuery extends LuceneTestCase {
       }
       TermRangeQuery cq=TermRangeQuery.newStringRange("asc", format.format(lower), format.format(upper),
true, true);
       LegacyNumericRangeQuery<Integer> tq= LegacyNumericRangeQuery.newIntRange("trie",
lower, upper, true, true);
-      TopDocs trTopDocs = searcher.search(cq, 1);
-      TopDocs nrTopDocs = searcher.search(tq, 1);
+      TopScoreDocCollector trCollector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
+      TopScoreDocCollector nrCollector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
+      searcher.search(cq, trCollector);
+      searcher.search(tq, nrCollector);
+      TopDocs trTopDocs = trCollector.topDocs();
+      TopDocs nrTopDocs = nrCollector.topDocs();
       assertEquals("Returned count for LegacyNumericRangeQuery and TermRangeQuery must be
equal", trTopDocs.totalHits.value, nrTopDocs.totalHits.value );
     }
     reader.close();


Mime
View raw message