Flarum Support for Chinese Keyword Search Optimization
Flarum itself is quite unfriendly toward Chinese. As the versions have evolved, it has gradually begun optimizing its support for Chinese, such as supporting Chinese username registration, which is indeed quite useful. However, the latest beta11 version still does not support searching Chinese content. Fortunately, MySQL has supported full-text indexing for Chinese and Japanese since version 5.7.
In addition, Flarum developers have also said that future versions will use the ElasticSearch distributed full-text search engine, because ElasticSearch is better than this method. However, it has still not been implemented. Please note that this method will affect database performance to some extent.
Method
Modify mysql.cnf and add:
[mysqld]
ngram_token_size=2
After making the modification, the FULLTEXT indexes need to be rebuilt:
ALTER TABLE flarum_posts DROP INDEX content;
CREATE FULLTEXT INDEX content ON `flarum_posts` (`content`) WITH PARSER ngram;
ALTER TABLE flarum_discussions DROP INDEX title;
CREATE FULLTEXT INDEX title ON `flarum_discussions` (`title`) WITH PARSER ngram;
After rebuilding them, clear the cache in the Flarum administration panel, and you will be able to search Chinese content, including article titles and article content.

Comments
(19)mysql.cnf在哪里呀?
宝塔面板的在 /etc/my.cnf
ok,谢谢
重建 FULLTEXT 索引是什么意思?不太懂呢
就是重新建立全文索引
在哪里建立?
<img src="https://img.8b5.cn/2020/02/18/b11828946fb73.png" style="height:100px;width:200px;"/>
错误 SQL 查询: ALTER TABLE flarum_posts DROP INDEX content MySQL 返回: 文档 #1146 - Table 'fl.flarum_posts' doesn't exist
你的数据表前缀是不是flarum_
哦哦,我懂了
怎么才能中文注册
beta11已支持中文用户名
注册时候显示“用户名只能包含字母、数字及横线 (-)” 不能注册 请问怎么设置?
只想夸你,解决了我的问题
客气了 ::aru:proud::
感谢,问题解决了~
不客气
成功了 点赞 好评
感谢支持