I want to filter my result set before I search. I know the correct way
to do this is by using the filter query (fq) parameter. However, I want
to filter based on the output of a function performed on a field.
I have a field 'rating' which is an integer in the range of 1 to ~75000.
The upper limit may change. I want to filter to the top 500 items with
the highest 'rating'. In SQL this would be something like:
... ORDER BY rating DESC LIMIT 500
I think I can get the documents in solr ranked by rating descending by
using the function rord(rating), so basically I would like to do:
fq=rord(rating):[0 TO 500]
But that does not seem possible. Does anyone know what else I could do?
Note that ord() and rord() won't work properly in Solr 1.4 trunk.
Lucene has changed to searching per-segment in a MultiReader and hence
you will currently get the ord() or rord() in that segment, not in the