场景:在新的项目上,需求文档中,搜索结果的排序:搜索结果按照与搜索内容的匹配度进行排序
通常列表排序:通常按create time 或id 升序、降序排
按搜索内容的匹配度排序,是怎么实现的呢?
-------------------------------------------------------------------------------
参照:https://blog.csdn.net/alangshan/article/details/81120942
SELECT * FROM mov_video_info WHERE title LIKE '%魔兽%' ORDER BY REPLACE(title,'魔兽','') LIMIT 10
----
匹配时不一定用like ,关键在order by replace(title,'魔兽',' ')
类比order by id desc