Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sort two fields in Solr 3.6

Tags:

solr

In the web request url there is a "sort" option. However, how do i sort by two fields? If I do something like:

 sort=field1 asc&sort=field2 desc

Only the first field will be used for sorting upon my observations.

like image 579
trillions Avatar asked Aug 03 '12 22:08

trillions


2 Answers

you do it this way:

sort=field1 asc, field2 desc
like image 106
Persimmonium Avatar answered Sep 28 '22 22:09

Persimmonium


SOLR(3.6.2) but if you want to sort additional intField in couple with 'score'
try to search instead of:

sort=score desc,intField desc

this one:

sort=intField desc,score desc
like image 25
headroot Avatar answered Sep 28 '22 22:09

headroot