I just tried a simple test with the example data, and things seem to
be working fine...

I tried this:
http://localhost:8983/solr/select
  ?q=*:*
  &rows=100
  &fl=id, inStock, if(inStock,10,0)

I saw values of 10 when inStock==true and values of 0 when it was
missing or explicitly false.
Perhaps you forgot to commit your changes when you removed the inStock
field from one of the example docs?

-Yonik
http://lucidworks.com


On Tue, Sep 10, 2013 at 9:25 AM, Elodie Sannier
<elodie.sann...@kelkoo.fr> wrote:
> Hello,
>
> I am using the solr version 4.4.0, when I'm using FunctionQuery with boolean
> fields, it seems that the default field value  is "true" for documents
> without a value in the field.
>
> The page http://wiki.apache.org/solr/FunctionQuery#field says "0 is returned
> for documents without a value in the field." so we could expect that the
> field value would be "false".
>
> Starting from the "SolrCloud - Getting Started" page with the document
> exampledocs/ipod_video.xml and removing the boolean field "inStock": <field
> name="inStock">true</field> demonstrates the problem.
> When requesting with bf=if(inStock,10,0) :
> curl -sS
> "http://localhost:8983/solr/select?q=*:*&bf=if%28inStock,10,0%29&defType=edismax&debugQuery=true";
> Result indicates that field value for boolean field "inStock" is seen as
> "true" :
> 7.071068 = (MATCH) FunctionQuery(if(bool(inStock),const(10),const(0))),
> product of:
>     10.0 = if(bool(inStock)=true,const(10),const(0))
>     1.0 = boost
>     0.70710677 = queryNorm
>
> Same behaviour using FunctionQuery via LocalParams syntax :
> http://localhost:8983/solr/select?q={!func}if%28inStock,10,0%29&debugQuery=true
> 10.0 = (MATCH) FunctionQuery(if(bool(inStock),const(10),const(0))), product
> of:
>   10.0 = if(bool(inStock)=true,const(10),const(0))
>   1.0 = boost
>   1.0 = queryNorm
>
> Is that expected ?
>
> Elodie Sannier
>
>
> Kelkoo SAS
> Société par Actions Simplifiée
> Au capital de € 4.168.964,30
> Siège social : 8, rue du Sentier 75002 Paris
> 425 093 069 RCS Paris
>
> Ce message et les pièces jointes sont confidentiels et établis à l'attention
> exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce
> message, merci de le détruire et d'en avertir l'expéditeur.

Reply via email to