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

Terry Smith commented on LUCENE-6446:
-------------------------------------

The refactored Explanation looks great, however I see a couple of small issues 
worth raising.

1. The constructor is private and there is a protected toString(int depth) 
method, it doesn't look like anyone else is calling it and no-one can subclass 
it. Should this method be private?

2. The toString() output is different! ComplexExplanation had a slightly 
different getSummary() method:

{code}
    return getValue() + " = "
      + (isMatch() ? "(MATCH) " : "(NON-MATCH) ")
      + getDescription();
{code}

versus

{code}
    return getValue() + " = " + getDescription();
{code}

I find this extra context invaluable, especially with the decoupling of score 
and match, we can't assume that a score of 0 is a NON-MATCH yet the output no 
longer tells is if an explanation is a MATCH or not.

I understand that I can roll my own string building code with the current API. 
It'd be great if the default output was as useful as possible.


> Simplify Explanation API
> ------------------------
>
>                 Key: LUCENE-6446
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6446
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: Trunk, 5.2
>
>         Attachments: LUCENE-6446.patch
>
>
> We should make this API easier to consume, for instance:
>  - enforce important components to be non-null (eg. description)
>  - decouple entirely the score computation from whether there is a match or 
> not (Explanation assumes there is a match if the score is > 0, you need to 
> use ComplexExplanation to override this behaviour)
>  - return an empty array instead of null when there are no "details"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to