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

Hoss Man commented on LUCENE-3013:
----------------------------------

bq. 2. Add subclasses of Explanation with enough methods for callers to 
interrogate the individual details of the explanation instead of outputting it 
as a monolithic string.

I think this is definitely the way to go ... most Explanation objects tend to 
fall into two fairly basic categories...

* atomic value (ie: the norm for a field, boost multiplier, etc...)
* mathmatic operation on sub explanations (ie: product of all child 
explanations; addition of all child explanations; etc..)

I think each of those should be concrete subclasses of ComplexExplanation with 
methods for some of the fixed metadata (ie: the type of math operator), and i 
think we should then add more additional subclasses of each of those for the 
things that are really common in Lucene with additional methods where 
appropriate...

* QueryNormExplanation extends AtomicValueExplanation (no special methods)
* IDFExplanation extends AtomicValueExplanation (getDocFreq, getMaxDocs)
* QueryWeightExplanation extends ProductExplanation (getTerm)
* FieldNormExplanation extends AtomicValueExplanation (getField, getDocId)
* TFExplanation extends AtomicValueExplanation (getTerm, getFreq)
* etc...

...simple clients could then continue to use the simple getValue/getDescription 
methods, but more complex clients could use introspection to see if it's a 
ttype they want to generate a more user freindly "explanation" our of.

> I wish Lucene query explanations were easier to localise
> --------------------------------------------------------
>
>                 Key: LUCENE-3013
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3013
>             Project: Lucene - Java
>          Issue Type: Wish
>          Components: core/query/scoring
>            Reporter: Trejkaz
>
> Often users ask us to provide a nice UI to explain why a document matched 
> their query.  Currently the strings output by Explanation are very advanced, 
> and probably only understandable to those who have worked on Lucene.  I took 
> a shot at trying to make them friendlier, but it basically came down to 
> parsing the strings it output and trying to figure out what kind of query was 
> at each point (the inability to get to a Query from the Explanation is a 
> small part of the problem here), formulating the result into readable 
> English.  In the end it seems a bit too hard.
> The solution to this could be done in at least two ways:
> 1. Add getLocalizedSummary() / getLocalizedDescription() method(s) and use 
> resource bundles internally.  Projects wishing to localise these could add 
> their own resource bundles to the classpath and/or get them contributed to 
> Lucene.
> 2. Add subclasses of Explanation with enough methods for callers to 
> interrogate the individual details of the explanation instead of outputting 
> it as a monolithic string.
> I do like the tree structure of explanations a lot (as it resembles the query 
> tree), I just think there is work to be done splitting up the strings into 
> usable fragments of information.

--
This message is automatically generated by JIRA.
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