开发者

sphinxsearch , Mysql like : order by lang='2' desc , time_popular desc

开发者 https://www.devze.com 2023-01-02 22:31 出处:网络
is it possible with 开发者_JAVA百科sphinx to sort a result like this mysql query? order by lang=\'2\' desc , time_popular desc

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消