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