使用 MATCH AGAINST 搜索 MySQL 表时出现问题
我有一个包含事件数据的 MySQL 表。
在此表上,我有一个 FULLTEXT 索引,分别包含 varchar、text、text 类型的 event_title、event_summary、event_details。
标题的示例包括:“连接至关重要”、“急救”、“健康与安全”。
我可以按如下方式搜索该表:
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('connections');
返回名为“Connections Count”的事件没有问题。
但是,无论我尝试什么,在运行以下查询时都会得到一个空结果集:
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('first aid');
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('first');
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('aid');
我尝试将事件重命名为“Rich Aid”并且可以很好地搜索该事件。另外,《第一富》的效果也很棒。
任何关于为什么会发生这种情况或如何解决它的想法都会很棒!
感谢您抽出时间。
富有的
I have a MySQL table containing event data.
On this table, I have a FULLTEXT index, incorporating event_title,event_summary,event_details of types varchar,text,text respectively.
Examples of titles include: "Connections Count", "First Aid", "Health & Safety".
I can search the table as follows:
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('connections');
Which returns the events named "Connections Count" no problem.
However, no matter what I try, I get an empty result set when running the following queries:
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('first aid');
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('first');
SELECT * FROM events WHERE MATCH (event_title,event_summary,event_details) AGAINST ('aid');
I tried renaming an event to "Rich Aid" and could search for that just fine. Also, "First Rich" works great too.
Any ideas of why this is happening or how to fix it would be great!
Thanks for your time.
Rich
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“first”是一个 "stopword" 并且默认情况下除非您指定
ft_min_word_len
值,否则不会匹配 4 个字符以下的单词。"first" is a "stopword" and by default words below 4 caracters are not matched unless you specify
ft_min_word_len
value.