MySQL 全文(非)搜索
我有一个表,其中有视频数据,如“标题”、“描述”等。我正在尝试使用 MySQL 全文索引编写一个搜索引擎。 SQL 查询适用于某些单词,但不是每个单词。这是我的 SQL 查询;
SELECT *
FROM videos
WHERE MATCH (title, description) AGAINST ('XXXXXXXXXX' IN NATURAL LANGUAGE MODE)
我用查询词替换“XXXXXXXX”。它适用于“otomotiv”,但不适用于“otomoti”。如果找到“otomotiv”,是否必须找到“otomoti”,因为“otomoti”是整个单词“otomotiv”的一部分?
我尝试将搜索模式更改为“自然语言模式”或“带有查询扩展”,但仍然没有成功。
MySQL找不到整个单词的一部分是正常的吗?
I have a table where there are video data, like "title", "description" etc. I'm trying to write a search engine with MySQL fulltext indexing. The SQL query works with some words but not every word. Here is my SQL query;
SELECT *
FROM videos
WHERE MATCH (title, description) AGAINST ('XXXXXXXXXX' IN NATURAL LANGUAGE MODE)
where I replace "XXXXXXXX" with the query terms. It works with "otomotiv" but not with "otomoti". Doesn't it have to find "otomoti" if it finds "otomotiv", as "otomoti" is part of the whole word "otomotiv"?
I tried changing the search mode to "IN NATURAL LANGUAGE MODE" or "WITH QUERY EXPANSION" but still no luck.
Is it normal that MySQL can't find a part of the whole word?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要执行布尔全文搜索,因为它支持通配符运算符。
http://dev.mysql.com/doc/refman/5.5 /en/fulltext-boolean.html
You need to perform boolean full text search as it supports wildcard operator.
http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html