本文介绍了MySQL的FULLTEXT查询问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用mysql FULLTEXT进行查询,但不幸的是,它返回的空结果甚至包含那些输入关键字。
表格:user_skills :
+ ---- + -------------------------------------------- - +
| id |技能|
+ ---- + ---------------------------------------- ------ +
| 1 |舞蹈表演者,DJ,艺人,活动策划师|
| 2 |动画,相机操作员,电影方向|
| 3 | DJ |
| 4 |制图员|
| 5 |化妆师|
| 6 | DJ,音乐制作人|
+ ---- + ---------------------------------------- ------ +
索引:
查询:
SELECT id,skills
FROM user_skills
WHERE(MATCH(skills)AGAINST('+ dj'IN BOOLEAN MODE ))
在运行上述查询之后,没有一个 DJ
行正在返回。在表中有3行,其值为
dj
。
解决方案
您的搜索字词为short
I'm trying to query using mysql FULLTEXT, but unfortunately its returning empty results even the table contain those input keyword.
Table: user_skills:
+----+----------------------------------------------+
| id | skills |
+----+----------------------------------------------+
| 1 | Dance Performer,DJ,Entertainer,Event Planner |
| 2 | Animation,Camera Operator,Film Direction |
| 3 | DJ |
| 4 | Draftsman |
| 5 | Makeup Artist |
| 6 | DJ,Music Producer |
+----+----------------------------------------------+
Indexes:
Query:
SELECT id,skills
FROM user_skills
WHERE ( MATCH (skills) AGAINST ('+dj' IN BOOLEAN MODE))
Here once I run the above query none of the DJ
rows are returning. In the table there are 3 rows with is having the value dj
.
解决方案
Your search term is to short
as in mysql doc
https://dev.mysql.com/doc/refman/5.6/en/fulltext-natural-language.html
https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html
这篇关于MySQL的FULLTEXT查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!