首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我使用where()语句过滤Meilisearch返回的结果时,meilisearch出错

当我使用where()语句过滤Meilisearch返回的结果时,meilisearch出错
EN

Stack Overflow用户
提问于 2021-08-10 17:16:10
回答 1查看 665关注 0票数 0

我正在使用Meilisearch作为幼虫童子军的驱动程序。

我在控制器中的代码:

代码语言:javascript
复制
public function search(SearchInArticlesRequest $request)
    {
        $query = $request->s;
        $articles = Article::search($query)
            ->where('article.status', '=', 'published')
            ->where('article.publish_date_time', '<=', Carbon::now()->toDateTimeString())
            ->paginate(20);
        return response()->json([
            'status' => 200,
            'message' => 'articles_were_returned',
            'entire' => [
                'articles' => $articles
            ]
        ]);
}

我的Article模型:

代码语言:javascript
复制
class Article extends Model
{
    use HasFactory, Searchable;

    protected $table = 'article';
    public function toSearchableArray()
    {
        return $this->only(['id', 'title', 'body' , 'slug']);
    }
}

我的composer.json文件:

代码语言:javascript
复制
"require": {
        "laravel/scout": "^9.2",
        "meilisearch/meilisearch-php": "^0.18.3",
    },

问题是:当调用我在上面几行中提到的控制器方法时,会出现以下错误:

Json deserialize error: unknown field filters, expected one of q, offset, limit, attributesToRetrieve, attributesToCrop, cropLength, attributesToHighlight, matches, filter, facetsDistribution at line 1 column 23

EN

回答 1

Stack Overflow用户

发布于 2021-08-11 07:36:53

您正在尝试使用的SDK目前仅与稳定v0.20兼容,RC为MeiliSearch 0.21rc

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68731010

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档