小项目有时需要用到关键词搜索相关性排序,用sphinx显得杀鸡用牛刀,就用mysql的order by对付下。方法一: 代码如下:select * from articles where (title LIKE ‘%keywords%’) or (content LIKE ‘%helloworld%’) order by ((CASE WHEN title LIKE ‘%keywords%’ THEN 2 ELSE 0 END) + (CASE WHEN content LIKE ‘%hello