[ 
https://issues.apache.org/jira/browse/LUCENE-8606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16719183#comment-16719183
 ] 

Christian Ziech commented on LUCENE-8606:
-----------------------------------------

Attached a new patch that fixes all but 2 test failures:
{noformat}
   [junit4] Tests with failures [seed: 9F8CCC24EB4194B4]:
   [junit4]   - org.apache.lucene.search.TestComplexExplanations.test2
   [junit4]   - 
org.apache.lucene.search.TestComplexExplanationsOfNonMatches.test2
{noformat}
Those two failures are both caused by a NPE in the LeafSimScorer which is 
caused by the SpanWeight trying to explain a result with a "null" scorer.

Also I had to include a kind of controversial change in the patch which removes 
the assertion "assert scoreMode.needsScores()" from the score() method of the 
AssertingScorer. The problem is that the explain method of the BooleanQuery is 
invoking the score() function to fill the value of the Explanation() object and 
if that BooleanQuery is explained in the context of a ConstantScoreQuery, this 
assertion would fire. 
I first tried to compute the value of the Explanation based on the detail 
explanations in the BooleanQuery, but that didn't quite add up due to 
double/float inaccuracies.


> ConstantScoreQuery looses explain details of wrapped query
> ----------------------------------------------------------
>
>                 Key: LUCENE-8606
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8606
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Christian Ziech
>            Priority: Major
>         Attachments: 
> 0001-LUCENE-8606-adding-a-constructor-for-the-ConstantSco.patch, 
> 0001-LUCENE-8606-overwriting-the-explain-method-for-Cachi.patch
>
>
> Right now the ConstantScoreWeigth used by the ConstantScoreQuery is not 
> adding the details of the wrapped query to the explanation. 
> {code}
> if (exists) {
>     return Explanation.match(score, getQuery().toString() + (score == 1f ? "" 
> : "^" + score));
> } else {
>     return Explanation.noMatch(getQuery().toString() + " doesn't match id " + 
> doc);
> }
> {code}
> This is kind of inconvenient as it makes it kind of hard to figure out which 
> term finally really matched when one e.g. puts a BooleanQuery into the FILTER 
> clause of another BooleanQuery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to