Apache Lucene open-source search software
LUCENE-7352: Fix CheckHits for DisjunctionMax queries that generate negative scores.
Adrien Grand1e4d51f40856
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java b/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.javaindex f12960501f9..9a14b5daa73 100644--- a/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java+++ b/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java@@ -354,8 +354,12 @@ public class CheckHits {if (detail.length==1) {// simple containment, unless it's a freq of: (which lets a query explain how the freq is calculated),// just verify contained expl has same score- if (!expl.getDescription().endsWith("with freq of:"))+ if (expl.getDescription().endsWith("with freq of:") == false+ // with dismax, even if there is a single sub explanation, its+ // score might be different if the score is negative+ && (score >= 0 || expl.getDescription().endsWith("times others of:") == false)) {verifyExplanation(q,doc,score,deep,detail[0]);+ }} else {// explanation must either:// - end with one of: "product of:", "sum of:", "max of:", or