MySQL MATCH AGAINST 功能
目前我有以下查询...
SELECT id,
LOWER(title) as title,
LOWER(sub_title) as sub_title
FROM ebay_archive_listing
WHERE MATCH(title, sub_title) AGAINST ("key" IN BOOLEAN MODE)
但是它没有找到 title
包含单词“key”的行。 “key”是根据一组关键字动态生成的,因此有时它包含+和-符号。
Currently I have the following query...
SELECT id,
LOWER(title) as title,
LOWER(sub_title) as sub_title
FROM ebay_archive_listing
WHERE MATCH(title, sub_title) AGAINST ("key" IN BOOLEAN MODE)
However it is not finding rows where the title
contains the word "key". "key" is generated dynamically based on a set of keywords, so sometimes it contains + and - symbols.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MySQL 的默认全文索引设置不会索引或匹配任何少于四个字母的单词。
如果您有一个短语完全由少于四个字母的单词组成,例如
key
,则必须手动回退到未索引的LIKE
搜索。您可以通过降低
ft_min_word_len来更改此行为
设置。您可能还想在使用时更改或禁用“停用词”列表(也未编入索引),因为默认列表是残酷且奇怪的。MySQL's default fulltext indexing settings won't index or match any word of fewer than four letters.
If you have a phrase made entirely of words of fewer than four letters like
key
you have to manually fall back to an unindexedLIKE
search instead.You can change this behaviour by lowering the
ft_min_word_len
setting. You might also want to change or disable the list of ‘stopwords’ (which are also not indexed) whilst you're at it, as the default list is brutal and bizarre.