views:

18

answers:

1

is it possible with 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 :)

A: 

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" );

Ian