Re: solr sorting on multiple conditions, please help

2011-05-19 Thread Chris Hostetter

: sort=query({!v=area_id: 78153}) desc, score desc
: 
: What I want to achieve is sort by if there is a match with area_id, then
: sort by the actual score

I think you can use the map function here to map all scores greater then 
zero (matching docs) to some fixed value.  something like this should 
work...

qq=area_id:78153
sort=map(query($qq,-1),0,,1) desc, score desc

http://wiki.apache.org/solr/FunctionQuery#map

-Hoss


solr sorting on multiple conditions, please help

2011-04-25 Thread James Lin
Hi Folks,

I got a problem on solr sorting as below:

sort=query({!v=area_id: 78153}) desc, score desc

What I want to achieve is sort by if there is a match with area_id, then
sort by the actual score

problem is, area_id is a multiple value, the result I am getting does not
sort by the actual score even the results all matches area_id 78153

I am getting results like this

Area 2, score 0.21
Area 3, score 0.38
Area 4, score 0.23

but the result should be like this

Area 3, score 0.38
Area 4, score 0.23
Area 2, score 0.21

Thanks heaps in advanced.

Regards

James