使用默认的方法是没问题的(如下):
public function toSearchableArray()
{
#_ Read Data
$Arr_Posts = $this -> toArray();
#_ Back to Scout
return $Arr_Posts;
}
但是我想加条件的话
public function toSearchableArray()
{
#_ Read Data
$Arr_Posts = $this -> select(['title','content']) -> get() ->toArray();
#_ Back to Scout
return $Arr_Posts;
}
就会出现如下提示:
Record at the position 6 objectID=10 is too big size=24300 bytes. Contact us if you need an extended quota
再次自问自答一波,反复看了 文档 以及
Github
上的一些issue
得出的结论:toArray()
方法返回的数据才行,所以如果你需要筛选要索引的数据的话,你必须围绕它来作文章,例如你只想要索引文章的标题和内容的话:issue
链接:https://github.com/laravel/sc...