gwk wrote:
Hi,

I'm playing around with sorting via functionqueries, and I've set _val_ to the following:

sum(product(always_on_top,5),recip(rord(publication_date),1,1000,1000))

Where the field always_on_top is a simple boolean field, where documents with always_on_top:true should always be on top. I ran into a problem where one of the documents with always_on_top = true was all the way on the bottom instead of on top. So I extracted the query out of my system en copied it to my browser and added &debugQuery=true which gave a NullPointerException. After some searching I found out the document in question had no publication_date field set (which is totally my fault) however it took quite a while to discover this since I couldn't turn on debugQuery. Is this a bug or expected behviour?

Regards,

gwk

Oops, it seems it's due to a fq in the same query, not because of the, there's a range query on price:

fq=price:({0 TO *} OR 0)

Removing this filter makes debugQuery work however strange thing happen, I took my original query and took the first result and the last result and performing the query (on unique id) without the fq and debugQuery=true yields:

<result name="response" numFound="2" start="0" maxScore="10.288208">
<doc>
  <float name="score">10.288208</float>
  <double name="price">195500.0</double>
  <date name="publication_date">2009-06-12T12:07:11Z</date>
  <bool name="always_on_top">true</bool>
  <str name="id">695658</str>
</doc>
<doc>
  <float name="score">5.1031165</float>
  <double name="publication_date">680000.0</double>
  <bool name="always_on_top">true</bool>
  <str name="id">147563</str>
</doc>
</result>

while debug part of the response contains:

<lst name="explain">
<str name="695658">
10.287015 = (MATCH) sum of:
0.09950372 = (MATCH) MatchAllDocsQuery, product of:
  0.09950372 = queryNorm
10.187511 = (MATCH) FunctionQuery(sum(product(ord(homepage_teaser),const(5.0)),1000.0/(1.0*float(top(rord(first_publication_date)))+1000.0))), product of: 10.238322 = sum(product(ord(homepage_teaser)=2,const(5.0)),1000.0/(1.0*float(rord(first_publication_date)=3196)+1000.0))
  10.0 = boost
  0.09950372 = queryNorm
</str>
<str name="147563">
10.078215 = (MATCH) sum of:
0.09950372 = (MATCH) MatchAllDocsQuery, product of:
  0.09950372 = queryNorm
9.978711 = (MATCH) FunctionQuery(sum(product(ord(homepage_teaser),const(5.0)),1000.0/(1.0*float(top(rord(first_publication_date)))+1000.0))), product of: 10.028481 = sum(product(ord(homepage_teaser)=2,const(5.0)),1000.0/(1.0*float(rord(first_publication_date)=34112)+1000.0))
  10.0 = boost
  0.09950372 = queryNorm
</str>
</lst>

So the score in the response doesn't match the score in debugQuery's output. Does this have something to do with SOLR-947?

I'm currently using Solr 1.4 trunk (revision 787997, which is about a month old iirc)

Regards,

gwk

Reply via email to