MySQL MyISAM 全文搜索-如何添加'#'作为 utf8 字符集的单词字符?
我正在使用 MyISAM 全文搜索。表列具有字符集“utf8”和“utf8_general_ci”作为排序规则。
现在我想实现#HashTag系统,这样如果我搜索“#HashTag”,则只显示包含“#HashTag”的行。不是只包含“HashTag”的行。
根据此MySQL文档中的评论,对于非多字节字符集(即具有固定宽度编码的字符集)来说很容易做到这一点。
但我找不到关于如何对 utf8 字符集执行此操作的良好参考。有人对 utf8 字符集列做过这个吗?如果是的话,您能列出具体步骤吗?
另外,如果可能的话,我想避免重新编译 MySQL。
I am using MyISAM full text search. The table columns are having charset "utf8" and "utf8_general_ci" as collation.
Now I want to implement #HashTag system, so that if I search for "#HashTag", only rows that contain "#HashTag" show up. Not rows that just contains "HashTag".
According to the comment in this MySQL documentation, its easy to do it for non-multibyte charsets, that is charsets with fixed-width encoding.
But I could not find a good reference for how to do it for utf8 charset. Has anyone done this for utf8 charset columns? If yes, could you list the exact steps?
Also, I want to avoid recompiling MySQL if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是您问题的答案,但是在输入期间使用正则表达式解析哈希标签并将它们存储在单独的列中不是一个好主意吗?可能比让 mySQL 接受
#
作为搜索字符更容易(也更快)。Not an answer to your question, but would it not be a good idea to parse out the hash tags during input time using a regular expression, and store them in a separate column? Might be easier (and faster) than bending mySQL into accepting
#
as a search character.