is it possible with 开发者_JAVA百科sphinx to sort a result like this mysql query? order by lang='2' desc , time_popular desc so get the latest documents with lang=2 in fist position. I really need your help :)
Yes. Look at this page http://www.sphinxsearch.com/docs/current.html#sorting-modes and particularly SPH_SORT_EXTENDED.
Assuming you have attributes for them both:
sql_attr_uint = lang sql_attr_timestamp = time_popular
Then using the API for example:
$cl->SetSortMode ( SPH_SORT_EXTENDED, "lang desc, time_popular desc" );
You could use filer along with order like
SELECT * FROM your_index where lang=2 order by lang desc, time_pupular desc;
Hope it helps.
精彩评论