【问题标题】:Where does Laravel Scout store Meilisearch settings?Laravel Scout 在哪里存储 Meil​​isearch 设置?
【发布时间】:2021-09-09 17:44:52
【问题描述】:

我不是说过滤器,我是说设置:https://docs.meilisearch.com/reference/api/settings.html

假设我想更改特定模型(甚至所有模型)的默认 Meil​​isearch 'stopword' 设置

$client->index('movies')->updateStopWords(['the', 'of', 'to']);

我该怎么做?

【问题讨论】:

    标签: laravel laravel-scout meilisearch


    【解决方案1】:

    Scout 使用 Meil​​isearch 客户端创建一个单例。这意味着您可以像这样从 laravel 容器中的任何位置访问实例:

    $client = app(\MeiliSearch\Client::class);
    $client->index('movies')->updateStopWords(['the', 'of', 'to']);
    

    【讨论】:

    • 您是应该在您的应用程序中的某个地方拥有此代码,还是通过控制台一次性运行它?
    • @neojp 设置不会保存在任何地方,它们是在运行时读取的,这意味着它必须在您的应用程序中,例如在ScoutServiceProvider 中。
    猜你喜欢
    • 2021-06-20
    • 2021-12-23
    • 2022-10-25
    • 2021-08-03
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    • 2014-09-21
    • 1970-01-01
    相关资源
    最近更新 更多