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

Adrien Grand commented on LUCENE-8606:
--------------------------------------

bq. changing the Constructor signature would be possibly problematic

The API is expert: only users that write custom queries would be affected. Plus 
APIs that we expect to occasionally need to change are usually tagged with 
@lucene.internal or @lucene.experimental to let users know about this. So 
changing the API is not a big deal.

bq. So I'd add another constructor that would pass in the wrapped Weigth. So 
the behavior would be improved if the wrapped weight is passed in, and would 
remain unchanged if that weight is missing. 

Actually I'm not sure that we need to change ConstantScoreWeight at all: 
ConstantScoreQuery is the only place where we create a ConstantScoreWeight that 
pulls scorers from another weight. So it looks like we would be fine by only 
changing the anonymous subclass of ConstantScoreWeight that is created from 
ConstantScoreQuery#createWeight?

> 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
>
> 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