请教各位关于搜索按关键词密度排序的问题 多谢了~

WBOY
Release: 2016-06-23 14:21:41
Original
936 people have browsed it

想自己做个网站搜索的页面 php mysql apache 
大概是这样的
搜索的表
id    title                url           content
-------------------------------------------------------------
0     啦啦吃啦啦           http://a       r3453
1     喝啦吃啦啦           http://b       34543
2     吃啦啦喝玩啦乐       http://c        435345

搜索的时候 只需要搜索 title 一个字段就可以

比如 我搜索 “吃 喝 玩 乐”

这样 出来的结果是:(就是把匹配多的关键词排在前面)


吃啦啦喝玩啦乐
喝啦吃啦啦 
啦啦吃啦啦

小弟在此谢过大家了 请多多指教~ 谢谢


回复讨论(解决方案)


忘了说了 俺想问 sql语句咋写哈 ~

建议不要用sql,用sphinx(Coreseek),能够满足你的需求,按照weight来排序。这里:http://www.coreseek.cn/


sphinx 知道这么个东西 因为俺不是纯程序员 不是太了解程序这东西

用这个是不是有点杀鸡用了宰牛刀啊 ~

现在你的这个功能可不是鸡,是牛。并发数一上来,这个用sql来实现,你的数据库怕抗不住。

Sphinx 这个东西好像很麻烦的说啊 。

mysql全文索引

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!