LUCENE-2635: fix BQ to not provide matching explanation if a required sub-clause has null scorer

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@994976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-09-08 10:33:38 +00:00
parent 5d74641c6c
commit f4d567eb06
1 changed files with 5 additions and 0 deletions

View File

@ -240,6 +240,11 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
Weight w = wIter.next();
BooleanClause c = cIter.next();
if (w.scorer(reader, true, true) == null) {
if (c.isRequired()) {
fail = true;
Explanation r = new Explanation(0.0f, "no match on required clause (" + c.getQuery().toString() + ")");
sumExpl.addDetail(r);
}
continue;
}
Explanation e = w.explain(reader, doc);