查找按mysql中的最佳结果排序的文本

时间:2017-08-27 06:45:35

标签: mysql search full-text-search sql-like

我在“MySql”中使用“FullText”因为文中有非相关词(未知)

表格名称:找到

记录

id      |     name
----------------------------
1             help me
2             helply goods
3             this help good every
4             this easy helps goods
5             this help good

我试试这段代码:

SELECT * FROM `Find`
WHERE MATCH(`name`) AGAINST('internet* help* this* good* for* alll*' IN BOOLEAN MODE)
  

“IN BOOLEAN MODE”显示所有包含这些单词之一的记录。

     

我想要像“IN NATURAL LANGUAGE MODE”这样的搜索方法来显示   最好的结果。但是通过这种方式,应该写出正确的单词   不好

     

所以我必须使用IN BOOLEAN MODE方法

此查询的输出是:

id      |     name
----------------------------
2             helply goods
3             this help good every
4             this easy helps goods
5             this help good

但我想运行按“最佳结果”排序的查询 示例查找:internet * help * this * good * for * alll *

输出:

id      |     name
----------------------------
5     |     this help good
3     |     this help good every
4     |     this easy helps goods
2     |     helply goods
1     |     help me

0 个答案:

没有答案