请问大佬们,论坛使用 了 MeiliSearch
安装的扩展是:
composer require clarkwinkelmann/flarum-ext-scout
composer require meilisearch/meilisearch-php:"0.23.*"
后台设置是:
前缀: ss_
Meilisearch 主机地址: http://127.0.0.1:7700
key: 对应的masterKey
在服务器通过: Docker安装 Meilisearch 服务器。
root@xxx:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7c356db37843 getmeili/meilisearch "tini -- /bin/sh -c …" 9 seconds ago Up 8 seconds 0.0.0.0:7700->7700/tcp, :::7700->7700/tcp meilisearch
root@xxx:~# curl \
-X GET 'http://localhost:7700/indexes' \
-H 'Authorization: Bearer kkkkkKKkkkkkkk'
{"results":[],"offset":0,"limit":20,"total":0}root@kl4fthzoun27869:~#
导入数据:
root@kl4fthzoun27869:/www/wwwroot/# php flarum scout:import 'Flarum\Discussion\Discussion'
Imported [Flarum\Discussion\Discussion] models up to ID: 7
All [Flarum\Discussion\Discussion] records have been imported.
我在命令行使用,能够查到数据
curl -X GET 'http://127.0.0.1:7700/indexes/ss_discussions/search' \
-H 'Authorization: Bearer kkkkkk' \
-d '{"q": "这个男人"}'
{"hits":[{"id":1,"title":"nihao "},{"id":2,"title":"虽然不是英雄 히어로는 아닙니다만 (2024) 更新04"},{"id":5,"title":"这个男人来自地球.2007.1080P.中文字幕"},{"id":6,"title":"这个男人来自地球.2007.1080P.中文字幕"},{"id":7,"title":"啊撒大声
但是我在前端Flarum搜索的时候接口全部报错了。 是什么地方缺少配置吗。
请求网址:https://wpzy.cc/api/discussions?include=user%2ClastPostedUser%2CmostRelevantPost%2CmostRelevantPost.user%2Ctags%2Ctags.parent%2Cuser.userBadges%2Cuser.userBadges.badge%2CfirstPost&filter%5Bq%5D=ze%27g%20&sort&page%5Boffset%5D=0
请求方法:GET
状态代码:500 Internal Server Error
远程地址:172.67.161.44:443
引荐来源网址政策:same-origin
是不是要 修改config.php里面配置 。麻烦了。