You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2015/07/29 01:10:04 UTC

[jira] [Resolved] (SOLR-7845) sum should treat NULL as 0

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

Hoss Man resolved SOLR-7845.
----------------------------
    Resolution: Not A Problem

This is working as designed.

The change in behavior is due to a bug that was fixed in the underlying math ValueSources in 5.0, and explicitly called out in the Solr upgrading instructions for 5.0...

bq. Bugs fixed in several ValueSource functions may result in different behavior in situations where some documents do not have values for fields wrapped in other value sources. Users who want to preserve the previous behavior may need to wrap fields in the "def()" function. Example: changing "fl=sum(fieldA,fieldB)" to "fl=sum(def(fieldA,0.0),def(fieldB,0.0))". See LUCENE-5961 for more details. 

Using the techproducts example data the various options are easy to compare...

{noformat}
http://localhost:8983/solr/techproducts/select?x=id:USD&q=cat:currency&fl=id,query%28$x%29,sum%281,query%28$x%29%29,sum%281,def%28query%28$x%29,0%29%29
{noformat}



> sum should treat NULL as 0
> --------------------------
>
>                 Key: SOLR-7845
>                 URL: https://issues.apache.org/jira/browse/SOLR-7845
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Bill Bell
>
> sum(0,query()) used to treat the NULL values in query as 0. It stopped working in SOLR 5.
> Do we want to fix this?
> {noformat}
> http://localhost:8983/solr/select?hqval1=pwid:2&q=*:*&fl=pwid,$y&y=sum(0,query({!lucene%20v=$hqval1}))
> {noformat}



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

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