I have a simple set of docs containing two fields, an id and a price. When I run a constant score query, such as *:*, I, of course, get a score back of 1 for all the docs.

If I add a simple Field Value function query to the constant score query, as in: *:* _val_:price_f, the query norm comes into play and I don't get back what I thought I would, which is the score would be the value of the field:
 <lst name="debug">
 <str name="rawquerystring">*:* _val_:price_f</str>
 <str name="querystring">*:* _val_:price_f</str>
<str name="parsedquery">+MatchAllDocsQuery(*:*) +FunctionQuery(float (price_f))</str>
 <str name="parsedquery_toString">+*:* +float(price_f)</str>
 <lst name="explain">
  <str name="7">
70712.48 = (MATCH) sum of:
  0.70710677 = (MATCH) MatchAllDocsQuery, product of:
    0.70710677 = queryNorm
  70711.766 = (MATCH) FunctionQuery(float(price_f)), product of:
    100001.54 = float(price_f)=100001.54
    1.0 = boost
    0.70710677 = queryNorm
</str>

As a workaround, I can do: *:*^0 _val_:price_f, which gets rid of the query norm factor.

I realize I could override the similarity or use the workaround, but I was just curious about what other people think of this.

Thanks,
Grant

Reply via email to