[ 
https://issues.apache.org/jira/browse/SOLR-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12836387#action_12836387
 ] 

Yonik Seeley commented on SOLR-1785:
------------------------------------

In Solr 1.3 and before, +-Inf were handled normally, and scores of NaN caused 
the relative ordering of other documents to be mixed up.
The new lucene collectors used in 1.4 can't all handle -Inf and NaN (they can 
return Integer.MAX_VAL to be returned as a docid), leading to exceptions as 
seen in SOLR-1778.  Because of this Solr's function queries normalized their 
output to exclude -Inf and NaN.  Unfortunately, this is not sufficient, because 
non-infinite scores can combine with a boolean query into an infinite score.  
And once you have an infinite score, a simple multiplication by zero will yield 
a NaN.

example: 
http://localhost:8983/solr/select?fl=id,score&q=_val_:"-3e38"+_val_:"-3e38";

Properly handing -Inf is an easy fix.  The bigger question is how to handle NaN.
We could:
1) punt and realize that any NaNs will mess up the ordering of all other 
documents for that request
2) Move the FunctionQuery normalization that changes -Inf and NaN into 
-Float.MAX_VALUE to right before collection (probably with a wrapper 
collector).  This would preserve the ordering of all the other documents, at 
the cost of a little performance, and information loss (the fact that there was 
a NaN or -Inf).
3) Completely order NaNs (probably after -Inf)...  This keeps the most 
information, but would require implementing a custom comparator for score 
sorting (for anything other than a simple score desc).

> Handle +/-Inf, NaN when scoring 
> --------------------------------
>
>                 Key: SOLR-1785
>                 URL: https://issues.apache.org/jira/browse/SOLR-1785
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Yonik Seeley
>             Fix For: 1.5
>
>
> Scores of -Inf or NaN being collected can cause exceptions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to