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 19:41:05 UTC

[jira] [Updated] (SOLR-7845) 2 arg "query()" does not exist for all docs, even though second arg specifies a default value

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

Hoss Man updated SOLR-7845:
---------------------------
    Description: 
The 2 arg version of the "query()" was designed so that the second argument would specify the value used for any document that does not match the query pecified by the first argument -- but the "exists" property of the resulting ValueSource only takes into consideration wether or not the document matches the query -- and ignores the use of the second argument.

----

The work around is to ignore the 2 arg form of the query() function, and instead wrap he query function in def().

for example:  {{def(query($something), $defaultval)}} instead of {{query($something, $defaultval)}}



  was:
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}



        Summary: 2 arg "query()" does not exist for all docs, even though second arg specifies a default value  (was: sum should treat NULL as 0)

revised summary & description to match underlying problem Bill encountered.

Easy to reproduce using the techproducts example data with a request like so...

http://localhost:8983/solr/techproducts/select?x=id:USD&q=cat:currency&q1=query%28$x%29&q2=query%28$x,0%29&fl=id,exists%28$q1%29,exists%28$q2%29,$q1,$q2,def%28$q1,0%29,exists%28def%28$q1,0%29%29

> 2 arg "query()" does not exist for all docs, even though second arg specifies a default value
> ---------------------------------------------------------------------------------------------
>
>                 Key: SOLR-7845
>                 URL: https://issues.apache.org/jira/browse/SOLR-7845
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Bill Bell
>
> The 2 arg version of the "query()" was designed so that the second argument would specify the value used for any document that does not match the query pecified by the first argument -- but the "exists" property of the resulting ValueSource only takes into consideration wether or not the document matches the query -- and ignores the use of the second argument.
> ----
> The work around is to ignore the 2 arg form of the query() function, and instead wrap he query function in def().
> for example:  {{def(query($something), $defaultval)}} instead of {{query($something, $defaultval)}}



--
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