© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Kiran Timsina

A way to make lazy search ?

I have a db with hundred thousand products. the in-built search freezes the table as it searches on type. I made a text input to make implement the search but it also searches on every letter typed. Is there a way to make the search happen only when the the focus changes or enter is pressed?

Filter::make('search')
                        ->form([
                            Forms\Components\TextInput::make('product_query')->label('Search Product (Name, SKU)'),
                        ])
                        ->columnSpanFull()
                        ->query(function (Builder $query, array $data): Builder {
                            return $query->when(
                                $data['product_query'],
                                fn (Builder $query): Builder => $query->where('name', 'ilike', "%{$data['product_query']}%")
                                    ->orWhere('sku', 'ilike', "%{$data['product_query']}%")
                            );
                        }),
Filter::make('search')
                        ->form([
                            Forms\Components\TextInput::make('product_query')->label('Search Product (Name, SKU)'),
                        ])
                        ->columnSpanFull()
                        ->query(function (Builder $query, array $data): Builder {
                            return $query->when(
                                $data['product_query'],
                                fn (Builder $query): Builder => $query->where('name', 'ilike', "%{$data['product_query']}%")
                                    ->orWhere('sku', 'ilike', "%{$data['product_query']}%")
                            );
                        }),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Lazy loading global search
FilamentFFilament / ❓┊help
3y ago
Is there a way to make my global search start searching from 3 characters? To optimize the search.
FilamentFFilament / ❓┊help
8mo ago
getGlobalSearchResultUrl() make search results redirecting to a different resource
FilamentFFilament / ❓┊help
3y ago
Can searchable be used with lazy()?
FilamentFFilament / ❓┊help
2y ago