Native Scout Support #2755
Replies: 5 comments 2 replies
-
It's possible to add Scout support to any search, but we haven't made this the default as I don't want to add another setup step. What are you stuck on? I thought we documented it all. |
Beta Was this translation helpful? Give feedback.
-
The only documentation I was able to find was for Scout with Filament tables. I did not find anything other than that commit for Scout support for the global search. |
Beta Was this translation helpful? Give feedback.
-
sorry for replying to old discussion as I didn't find any solution, anyway I found a way with filament v3 , in resource page you can override getGlobalSearchResults like below, not sure if its the optimal solution but it works :) public static function getGlobalSearchResults(string $search): Collection
{
return Product::search($search)
->take(static::getGlobalSearchResultsLimit())
->get()
->map(function (Model $record): ?GlobalSearchResult {
$url = static::getGlobalSearchResultUrl($record);
if (blank($url)) {
return null;
}
return new GlobalSearchResult(
title: static::getGlobalSearchResultTitle($record),
url: $url,
details: static::getGlobalSearchResultDetails($record),
actions: static::getGlobalSearchResultActions($record),
);
})
->filter();
} |
Beta Was this translation helpful? Give feedback.
-
See the Docs: https://filamentphp.com/docs/3.x/tables/advanced#searching-records-with-laravel-scout |
Beta Was this translation helpful? Give feedback.
-
@coolsam726 - That is for table search, not global. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Something I've noticed is Filament's global search (and all searches for that matter) create some fairly ugly/unoptimized queries. It would be a phenomenal addition to add native Laravel Scout support. It appears there was some efforts put in to attempt to support this with PR #1605.
Is this on the roadmap at all? It would significantly speed up the searches and filters.
Thanks for the awesome admin panel!
Beta Was this translation helpful? Give feedback.
All reactions