使用Laravel Scout搜索时,我发现仅返回前500个结果。我查看了TNTSearch索引创建的SQLite数据库,它具有500多个匹配项。
SELECT COUNT(DISTINCT doclist.doc_id)
FROM wordlist
JOIN doclist ON doclist.term_id = wordlist.id
WHERE wordlist.term = 'qui'
上面的查询返回1139
。
此:Model::search('qui')->get()->count()
返回500
。
我无法找到500
的限制来源。我以为可能是config\scout.php
中的分块设置,但是更改这些值不会影响我的输出。
驱动程序类(vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php
)具有以下几行:
protected function performSearch(Builder $builder, array $options = [])
{
$index = $builder->index ?: $builder->model->searchableAs();
$limit = $builder->limit ?: 10000;
$builder->limit
由take()
函数设置。该代码使我相信,如果不定义限制,我将获得多达10,000个结果。但是,此:Model::search('qui')->take(750)->get()->count()
仍返回500
。
最后,我想获取整个结果集,但我什至无法超越更改限制的条件。
如果是错误,我已经打开了issue on the project。