: 1) The user gives a query, and also has an option to choose the "from" and
: "to" values for a specific field.
: (For Eg: Give me all documents that match the query Solr Users, but with
: those that were last updated between 10th and 20th of August ranked on top)
: 
: -Over here, I am currently using a BoostQuery functionality, to do this.
: However, along with this, I want to provide an additional option of Sorting
: these "boosted" results based on that range chosen above.

This should be doable using sort by function, but obviously you'd have to 
decide which "end" of the range should score higher.

the key would be to:
 * use a primary and a secondary sort
 * secondary sort is simple "score desc"
 * primary sort is on a function over the field whose range you care about
 * primary sort function needs to map all values out of the range to a 
constant value so secondary sort applies.

I haven't tested this out, but i think the "map" function should make this 
relatively straight forward... 

sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) desc, score desc
  
Assuming "-Infinity" and "Infinity" are actaully legal values in functions 
(if they aren't you'd need to pick some upper/lower limits) that should 
sort any doc where "myNumField" is between 10 and 20 first, with docs 
matching "20" sorting at the top above docs matching "19, 18, ... 10" and 
then after those docs all remaining matching docs will sort by score.


-Hoss

Reply via email to