Hello all.

I have the need to include the result of a computed value in the search results of solr query and sort by that value.
The documentation about FunctionQuery available at:

<http://wiki.apache.org/solr/FunctionQuery>

states that this is possible (see the "General Example" at the bottom), but I'm unable to make it work.

Using solr1.3 and the included example application this is what I get:

Query: http://localhost:8983/solr/select?q=id:SP2514N&fl=id,popularity,score>
numFound=1
score=3.5649493

But for the Query: <http://localhost:8983/solr/select?q=id:SP2514N _val_:"pow(popularity,2)"&fl=id,popularity,score>, the expected results were:
numFound=1
score=36

and what I get instead is:
numFound=26
score=13.155498 (for doc with id=SP2514N)

This is surprising for two reasons:

-The score value is not the square of the "popularity" field.
-The result set cardinality is altered by the use of the FunctionQuery and I was under the impression that functions changed the ordering of the results but had no effect on the actual number of matched documents.

Is this a bug in solr or the is documentation at fault?
Am I missing something? Is there any way to include a computed value in the search results and sort by it?

Thanks in advance.

--
/**
  * Luis Neves
  * @e-mail: luis.ne...@co.sapo.pt
  * @xmpp: lfs_ne...@sapo.pt
  * @web: <http://technotes.blogs.sapo.pt/>
  * @tlm: +351 962 057 656
  */

Reply via email to