mysql fulltext 返回零结果,即使表中存在确切的搜索短语
我有一个名为 myatts
的表:
- 它包含大约 3,332,834 行数据。
- 我通常搜索“内容”列
- 我有大约 40 行,其中 content = Rat,DD
但是,当我对其进行全文搜索时,我没有得到任何结果。但如果我使用 LIKE,我确实会得到结果。
我想坚持使用全文,谁能帮我弄清楚为什么没有返回结果?
这是我的表结构:
id
int(11) Not null AUTO_INCREMENT
join_id
int(11) Not Null
webid
int(11) Not Null
content
text utf8_general_ci
这是我的索引
Keyname Type Unique Packed Field Cardinality
PRIMARY BTREE Yes No id 3332834
content BTREE No No content (333) 238059
id_index BTREE No No webid 151492
join_id BTREE No No join_id 36
content_ft FULLTEXT No No content 119029
这是我的查询:
SELECT * FROM myatts WHERE MATCH(content) AGAINST('Rat, D.D.' IN BOOLEAN MODE)
这是解释:
1 SIMPLE myatts fulltext content_ft content_ft 0 1 Using where
任何帮助/指针都会很棒。谢谢!
I have a table called myatts
:
- It has about 3,332,834 rows of data.
- I generally search the column "content"
- I have about 40 rows where content = Rat, D.D.
However when I fulltext search for it I get no results. But if I use LIKE I do get the results.
I want to stick with fulltext, can anyone help me figure out why there are no results returned?
Here is my table structure:
id
int(11) Not null AUTO_INCREMENT
join_id
int(11) Not Null
webid
int(11) Not Null
content
text utf8_general_ci
Here are my indexes
Keyname Type Unique Packed Field Cardinality
PRIMARY BTREE Yes No id 3332834
content BTREE No No content (333) 238059
id_index BTREE No No webid 151492
join_id BTREE No No join_id 36
content_ft FULLTEXT No No content 119029
Here is my query:
SELECT * FROM myatts WHERE MATCH(content) AGAINST('Rat, D.D.' IN BOOLEAN MODE)
Here is the explain:
1 SIMPLE myatts fulltext content_ft content_ft 0 1 Using where
Any help/pointers would be great. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的最小字长可能设置为 4。检查 MySQL手册了解详细信息..
Your minimum word length is probably set to 4. Check the MySQL Manual for details..
默认情况下,MySQL 的全文索引器会忽略长度少于 4 个字符的单词。在你的 my.cnf 中设置这个变量:
你可能不想少于 3,因为你最终会得到误报。
By default MySQL's fulltext indexer ignores words that are fewer than 4 characters in length. In your my.cnf set this variable:
I you probably don't want to go less than 3 because you'll end up with false positives.