[ 
https://issues.apache.org/jira/browse/LUCENE-8012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Woodward updated LUCENE-8012:
----------------------------------
    Attachment: LUCENE-8012.patch

Updated patch:
- added a null check to the Explanation constructor
- all DoubleValuesSource.explain() implementations now use doubles
- tests now use Number comparisons or .doubleValue() where possible

There are still quite a few places in tests that explicitly ask for floats, 
most of which are to do with checking scores, so I think it's OK to check 
against floatValue() there?  One place I haven't touched is 
CheckHits.verifyExplanation() - I ran into problems trying to convert this to 
check Number rather than float, due to things like DOUBLE(0) and FLOAT(0) 
comparing as different.

We should open a separate issue to add explain() to LongValuesSource and 
enforce .longValue() to be used there

> Improve Explanation class
> -------------------------
>
>                 Key: LUCENE-8012
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8012
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Robert Muir
>              Labels: newdev
>         Attachments: LUCENE-8012.patch, LUCENE-8012.patch
>
>
> Explanation class is currently nice and simple, and float matches the scoring 
> api, but this does not work well for debugging numerical errors of internal 
> calculations (it usually makes practical sense to use 64-bit double to avoid 
> issues).
> Also it makes for nasty formatting of integral values such as number of 
> tokens in the collection or even document's length, its just noise to see 
> {{10.0}} there instead of {{10}}, and scientific notation for e.g. number of 
> documents is just annoying. 
> One idea is to take Number instead of float? Then you could pass in the 
> correct numeric type (int,long,double,float) for internal calculations, 
> parameters, statistics, etc, and output would look nice.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to