Customize table default search debounce behavior

I am currently using a filament table search at one of the main pages of the website. If the users enters a letter, the search will be triggered immediately which creates some db load.

How could I customize the default search to require a minimum of letters to be entered, search only when leaving the field or on enter, debounce timing and so on. I was able to do this with a custom form in a TextInput on getTableFilters with min() and lazy() but not with the default search field. Any recommendations how to do this?

    protected function getTableColumns(): array
    {
        return [
            Tables\Columns\TextColumn::make('name')
                ->limit(40)
                ->searchable(query: function (Builder $query, string $search): Builder {
                    return $query
                        ->where('name', 'like', "%{$search}%")
                        ->orwhereRelation('names', 'name', 'like', "%{$search}%");
                }),
        ];
    }
Was this page helpful?