Hello,

I'm new in Solr (4.7.2) and I was given the following requirement:

Given a query such as:

studentId:(875141 OR 873071 OR 875198 OR 108142 OR 918841 OR 870688 OR
107920 OR 870637 OR 870636 OR 870635 OR 918792 OR 107721 OR 875078 OR
875166 OR 875151 OR 918829 OR 918808)

I want the results to be ordered by the same order the elements were
informed in the query. This would be similar to MySQL's ORDER BY FIELD(id,
3,2,5,7,8,1).

I have tried to use term boosting
<https://wiki.apache.org/solr/SolrRelevancyCookbook#Boosting_Ranking_Terms>
in the query but that only works when I use big factors like this:
875078^100000
OR 875166^10000 OR 875151^1000 OR 918829^100OR 918808^10

But that would cause the query to be too big in case I have 200 ids for
instance.

So it seems I need to implement a custom FunctionQuery.
I'm a little lost on how to do that. Could someone please give me an idea?
Which classes should my custom class extend from? Where should I place this
class? Should I add to Solr project it self and regenerate the JAR?

Thanks

Reply via email to