Skip to content
二哥的秘密小站

时间漂流船

二哥的秘密小站

时间漂流船

Flarum 支持中文搜索的方法

Posted on 2023年2月4日

方法

修改 mysql.cnf,加入:

[mysqld]
ngram_token_size=2

以上可以在宝塔里面点击mysql,然后点configuration里面修改。

修改后需要重建 FULLTEXT 索引

进入PHPMYadmin,点击数据库表格,然后点击SQL,输入以下代码:
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;

点击执行即可。
其中,flarum_posts要跟你表格中的XX_posts一致,如果没有前xcc缀,就直接写posts。
执行完后,到flarumr后台点击清除缓存。就可以用了。
未分类

文章导航

Previous post
Next post

Search

Archives

  • 2025 年 7 月
  • 2025 年 6 月
  • 2025 年 1 月
  • 2024 年 12 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2023 年 12 月
  • 2023 年 9 月
  • 2023 年 8 月
  • 2023 年 7 月
  • 2023 年 6 月
  • 2023 年 5 月
  • 2023 年 4 月
  • 2023 年 2 月
  • 2022 年 12 月
  • 2022 年 10 月
  • 2022 年 8 月
  • 2022 年 7 月
  • 2022 年 6 月
  • 2022 年 2 月

其他操作

  • 注册
  • 登录
  • 条目 feed
  • 评论 feed
  • WordPress.org
©2025 二哥的秘密小站 | WordPress Theme by SuperbThemes