Mysql查询:匹配使用通配符

Dar*_*ney 2 mysql sql

我有一个名为'acts'的表,它有3列索引在一起:

act_name, short_description, main_description
Run Code Online (Sandbox Code Playgroud)

在表格中,一行有一个名为'red riot'的行为

当我执行以下搜索时,结果中会出现红色骚乱:

SELECT * from acts where MATCH(act_name, short_description, main_description) AGAINST ('*r*' IN BOOLEAN MODE)
Run Code Online (Sandbox Code Playgroud)

然而,如果我扩展它,并搜索*re*它不会返回任何结果:

SELECT * from acts where MATCH(act_name, short_description, main_description) AGAINST ('*re*' IN BOOLEAN MODE)
Run Code Online (Sandbox Code Playgroud)

这是为什么?有没有更好的方法在匹配查询时使用通配符?

我尝试过更改*%但是这两个查询都没有返回任何结果.

jok*_*ffe 6

值"re"是MATCH()搜索的禁用词.

http://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.html

[编辑]

确实,"re"是一个禁用词,但实际上这不起作用的原因是因为全文搜索排除了源材料中长度小于系统变量ft_min_word_len(其默认值为4)的值的单词.

因此,搜索"red*"会找到包含"redder"和"reddest"但不包含"red"的记录.

http://sqlfiddle.com/#!2/16d442/1