You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2018/03/14 15:19:34 UTC

[2/3] lucene-solr:branch_7x: TestGrouping.testRandom() requires BM25Similarity

TestGrouping.testRandom() requires BM25Similarity


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

Branch: refs/heads/branch_7x
Commit: db1360fac40fe472f881a37d6a0f0187491e308c
Parents: 5a59b5d
Author: Alan Woodward <ro...@apache.org>
Authored: Wed Mar 14 14:56:02 2018 +0000
Committer: Alan Woodward <ro...@apache.org>
Committed: Wed Mar 14 14:59:50 2018 +0000

----------------------------------------------------------------------
 .../test/org/apache/lucene/search/grouping/TestGrouping.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/db1360fa/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
----------------------------------------------------------------------
diff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
index b322fba..45a447e 100644
--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
@@ -58,6 +58,7 @@ import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.similarities.BM25Similarity;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
@@ -751,6 +752,9 @@ public class TestGrouping extends LuceneTestCase {
       Directory dirBlocks = null;
 
       final IndexSearcher s = newSearcher(r);
+      // This test relies on the fact that longer fields produce lower scores
+      s.setSimilarity(new BM25Similarity());
+
       if (VERBOSE) {
         System.out.println("\nTEST: searcher=" + s);
       }
@@ -786,6 +790,9 @@ public class TestGrouping extends LuceneTestCase {
       final Query lastDocInBlock = new TermQuery(new Term("groupend", "x"));
       
       final IndexSearcher sBlocks = newSearcher(rBlocks);
+      // This test relies on the fact that longer fields produce lower scores
+      sBlocks.setSimilarity(new BM25Similarity());
+
       final ShardState shardsBlocks = new ShardState(sBlocks);
       
       // ReaderBlocks only increases maxDoc() vs reader, which