Skip to content

Apache Lucene open-source search software

TestGrouping.testRandom() requires BM25Similarity

Alan Woodward446d38474eed
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 f59df5318f2..f7db6762d51 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
@@ -755,6 +755,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);
}
@@ -790,6 +793,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