mysql - 如何在Mysql中使用MATCH AGAINST而不是LIKE

标签 mysql sql sql-like

众所周知,LIKE 太慢,但当我尝试使用 MATCH AGAINST 时,它毫无用处。

我需要一些给出结果的操作数,例如 LIKE '%part%' 当“part”是单词的一部分而不是完整的单词时。

我已经尝试过

SELECT * FROM `table` WHERE MATCH (title) AGAINST ('*part*' IN BOOLEAN MODE)
SELECT * FROM `table` WHERE MATCH (title) AGAINST ('+*part*' IN BOOLEAN MODE)

它不工作

有什么解决办法吗?

最佳答案

您只能从单词开头匹配带有通配符的单词。作为documentation解释:

*

The asterisk serves as the truncation (or wildcard) operator. Unlike the other operators, it is appended to the word to be affected. Words match if they begin with the word preceding the * operator.

关于mysql - 如何在Mysql中使用MATCH AGAINST而不是LIKE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49905399/

相关文章:

sql - 如何从一个表中获取相关表中不存在的记录?

sql - 在 Postgres 中加入同一张表的不止一种路径

sql - 关于sql group by的一个问题

SQL Not Like 语句不起作用

php - SQL 未正确返回表中存在的行

Mysql字段自增等长

mysql - 如何使用 dapper 将对象列表插入数据库

mysql - 共享 SugarCRM 数据库的大问题

mysql - SQL : LIKE and "' "

不带通配符的 SQL LIKE 与 '=' 相同吗?