[ 
http://issues.apache.org/jira/browse/LUCENE-605?page=comments#action_12416660 ] 

paul.elschot commented on LUCENE-605:
-------------------------------------

I tried removing the Explanation constructor that is deprecated in the 
demo-fix.patch.
One of the uses of this constructor is in the (patched) BooleanQuery from line 
317,
and fixed it like this (under ASL 2):

      sumExpl.setMatch(Boolean.TRUE);
      sumExpl.setValue(sum);
      
      float coordFactor = similarity.coord(coord, maxCoord);
      if (coordFactor != 1.0f) { // coordination has effect
        sumExpl.setValue(sumExpl.getValue() * coordFactor);
        sumExpl.setDescription(sumExpl.getDescription() + " * " + coordFactor + 
"=coord("+coord+"/"+maxCoord+")");
      }
      return sumExpl;

The point is that adding by adding a match indicator to Explanation, 
Explanation becomes less useful
to explain a subformula of a (matching) score value, in this case the 
coordination factor.
The fix is to add the subformula to the description and the value of the 
explanation.

Btw. the actual explained score value was not changed by setValue() in the 
existing code for the coordination factor.
This is probably a bug in BooleanQuery.explain().

There seems to be no test for the explanation descriptions, and I did not have 
a look at the actually produced
getDescription() of the returned Explanation in this case.



> Make Explanation include information about match/non-match
> ----------------------------------------------------------
>
>          Key: LUCENE-605
>          URL: http://issues.apache.org/jira/browse/LUCENE-605
>      Project: Lucene - Java
>         Type: Improvement

>   Components: Search
>     Reporter: Hoss Man
>     Assignee: Hoss Man
>  Attachments: demo-fix.patch
>
> As discussed, I'm looking into the possibility of improving the Explanation 
> class to include some basic info about the "match" status of the Explanation 
> -- independent of the value...
> http://www.nabble.com/BooleanWeight.normalize%28float%29-doesn%27t-normalize-prohibited-clauses--t1596471.html#a4347644
> This is neccesary to deal with things like LUCENE-451

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to