Table and Global Search
Filament provides powerful search capabilities that go far beyond simple text matching. From global table searches that scan multiple columns simultaneously to individual column filters with custom query logic, these tools let you create sophisticated search experiences that help users find exactly what they need. Whether you're building a simple product catalog or a complex data management interface, Filament's search features adapt to your requirements with minimal configuration while offering extensive customization options for advanced use cases.
# Global table search
Enable instant searching across your entire table with a single search input that appears in the table header. The global search automatically queries all searchable columns, providing users with a familiar and intuitive way to filter large datasets. Perfect for when users need to quickly locate records without knowing exactly which field contains their search term.
->columns([
TextColumn::make('product.name')
->searchable()
->sortable(),
TextColumn::make('type')
->badge()
->searchable(),
TextColumn::make('quantity')
->numeric()
->searchable(),
TextColumn::make('reason')
->limit(50)
->searchable(),
TextColumn::make('user.name')
->searchable()
->sortable(),
TextColumn::make('created_at')
->dateTime()
->sortable(),
])
->searchPlaceholder('Search adjustments...')
# Individual column search
Add dedicated search inputs to specific columns, allowing users to filter data with precise control over each field. Individual column search works independently of global search, giving users the flexibility to combine multiple search criteria for highly targeted results. Ideal for complex datasets where users need granular filtering capabilities.
->columns([
TextColumn::make('product.name')
->searchable(isIndividual: true)
->sortable(),
TextColumn::make('type')
->badge()
->searchable(isIndividual: true),
TextColumn::make('quantity')
->numeric()
->searchable(isIndividual: true),
TextColumn::make('reason')
->limit(50)
->searchable(isIndividual: true),
TextColumn::make('user.name')
->searchable(isIndividual: true, isGlobal: false),
])
# Side-wide Search
Extend search capabilities across multiple columns and relationships using dot notation. Search through related models to find exactly what users need, from post content to author names to category tags, all in a single unified search experience.
// Resource class
class StockAdjustmentResource extends Resource
{
// Enable global search
protected static ?string $recordTitleAttribute = 'reason';
// Optimize performance for large datasets
protected static int $globalSearchResultsLimit = 10;
protected static ?bool $shouldSplitGlobalSearchTerms = false;
// Searchable data
public static function getGloballySearchableAttributes(): array
{
return [
'reference',
'reason',
'product.name',
'product.sku',
'user.email'
];
}