Laravel全文搜索与unicode字符

时间:2017-09-26 09:59:28

标签: php mysql laravel unicode

搜索全文搜索时遇到问题。

1.首先,当我搜索密钥没有unicode字符时,它会返回确切的结果。

$type = 'text';

$pattern = 'okman';

$nodes = Node::query()->whereRaw(" MATCH(pattern) AGAINST('$pattern') AND type = '$type' ")->get($columns);

记录的查询

select * from bot_nodes where MATCH(pattern) AGAINST('okman') AND type = 'text'

2.然后当我搜索密钥有unicode字符时,它返回空结果。

$type = 'text';
$pattern = 'nghỉ đi';
$nodes = Node::query()->whereRaw(" MATCH(pattern) AGAINST('$pattern') AND type = '$type' ")->get($columns);

记录的查询:

select * from bot_nodes where MATCH(pattern) AGAINST('nghỉ đi') AND type = 'text'

但是当我复制上面的查询并将其粘贴到navicat上运行时,它会返回完全查询。

我已经在database.php中设置了charset和collat​​ion utf8mb4

请帮帮我,谢谢。

0 个答案:

没有答案