user(); return ExcerptSearchResult::make( songs: $this->songRepository->getMany( ids: Song::search($keywords)->get()->take($count)->pluck('id')->all(), preserveOrder: true, scopedUser: $scopedUser ), artists: $this->artistRepository->getMany( ids: Artist::search($keywords)->get()->take($count)->pluck('id')->all(), preserveOrder: true ), albums: $this->albumRepository->getMany( ids: Album::search($keywords)->get()->take($count)->pluck('id')->all(), preserveOrder: true ), podcasts: $this->podcastRepository->getMany( ids: Podcast::search($keywords)->get()->take($count)->pluck('id')->all(), preserveOrder: 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(); } }