【发布时间】:2022-01-14 06:17:11
【问题描述】:
我正在使用 Laravel scout 和 Algolia 搜索。
我有这种雄辩的关系:
public function doctors()
{
return $this->belongsTo(Doctor::class, 'doctor_id');
}
在这里我通过 Algolia 搜索得到结果:
$doctors = DoctorInfo::search($this->search)
->with([
'typoTolerance' => true,
])
->paginate(10);
我收到很多单个查询:
select * from `doctors` where `doctors`.`id` = 131 limit 1
select * from `doctors` where `doctors`.`id` = 141 limit 1
select * from `doctors` where `doctors`.`id` = 191 limit 1
....
我怎样才能使用“whereIn”而不是“where”来获得一个有说服力的关系?
谢谢大家!
【问题讨论】:
标签: laravel search eloquent algolia laravel-scout