user(); return ExcerptSearchResult::make( $this->songRepository->getMany( ids: Song::search($keywords)->get()->take($count)->pluck('id')->all(), inThatOrder: true, scopedUser: $scopedUser ), $this->artistRepository->getMany(Artist::search($keywords)->get()->take($count)->pluck('id')->all(), true), $this->albumRepository->getMany(Album::search($keywords)->get()->take($count)->pluck('id')->all(), true), ); } /** @return Collection|array */ public function searchSongs( string $keywords, ?User $scopedUser = null, int $limit = self::DEFAULT_MAX_SONG_RESULT_COUNT ): Collection { return Song::search($keywords) ->query(static function (SongBuilder $builder) use ($scopedUser, $limit): void { $builder->withMetaFor($scopedUser ?? auth()->user())->limit($limit); }) ->get(); } }