From 9304ef9f118d24f76b280299706310ca8a0d40e6 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Fri, 14 Oct 2016 15:18:29 +0200 Subject: [PATCH] LUCENE-7486: Explain() should initialize maxScore to NEGATIVE_INFINITY too. --- .../src/java/org/apache/lucene/search/DisjunctionMaxQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java index b29126b3444..44cbd522fc2 100644 --- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java @@ -141,7 +141,7 @@ public final class DisjunctionMaxQuery extends Query implements Iterable @Override public Explanation explain(LeafReaderContext context, int doc) throws IOException { boolean match = false; - float max = 0.0f, sum = 0.0f; + float max = Float.NEGATIVE_INFINITY, sum = 0.0f; List subs = new ArrayList<>(); for (Weight wt : weights) { Explanation e = wt.explain(context, doc);