You added customer.name and vehicle.model to your global search attributes, and it works. Then you override getGlobalSearchResultDetails() to show the customer and vehicle info below each result. But now every single result fires two extra queries to load those relationships. Classic N+1.

The fix is simple, but easy to forget.
Here's what most people start with. You define searchable attributes using dot notation to include relationships:
app/Filament/Resources/InvoiceResource.php
public static function getGloballySearchableAttributes(): array{ return ['invoice_number', 'customer.name', 'vehicle.model'];}
This lets you search invoices by customer name or vehicle model. Filament handles the relationship queries for the search itself just fine.
The trouble starts when you want to show extra details in the search results:
public static function getGlobalSearchResultDetails(Model $record): array{ return [ 'Customer' => $record->customer->name, 'Vehicle' => "{$record->vehicle->year} {$record->vehicle->make} {$record->vehicle->model}", ];}
Every call to $record->customer and $record->vehicle triggers a lazy load. Multiply that by however many results Filament returns (up to 50 by default), and you've got a problem.
Override getGlobalSearchEloquentQuery() to eager load the relationships you're accessing in the result details:
app/Filament/Resources/InvoiceResource.php
use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Model; class InvoiceResource extends Resource{ protected static ?string $recordTitleAttribute = 'invoice_number'; public static function getGloballySearchableAttributes(): array { return ['invoice_number', 'customer.name', 'vehicle.make', 'vehicle.model']; } public static function getGlobalSearchResultDetails(Model $record): array { return [ 'Customer' => $record->customer->name, 'Vehicle' => "{$record->vehicle->year} {$record->vehicle->make} {$record->vehicle->model}", ]; } public static function getGlobalSearchEloquentQuery(): Builder { return parent::getGlobalSearchEloquentQuery() ->with(['customer', 'vehicle']); } }

Three things are happening here:
getGloballySearchableAttributes() tells Filament which columns (including relationship columns via dot notation) to search against. This handles the WHERE clauses.getGlobalSearchResultDetails() defines what extra info shows below each result title. This is where lazy loading sneaks in, because Filament calls this method on each result record.getGlobalSearchEloquentQuery() lets you modify the query that fetches the results. By adding ->with(['customer', 'vehicle']), both relationships are loaded in a single query instead of one per result.The searchable attributes and the result details are separate concerns. Just because Filament can search through customer.name doesn't mean it eager loads the customer relationship when rendering results. You have to tell it explicitly.
If you add a relationship to getGlobalSearchResultDetails() but forget to add it to getGlobalSearchEloquentQuery(), you won't see an error. Everything still works. It just runs slowly. This makes it easy to ship to production without noticing.
If you use Laravel Debugbar or have Model::preventLazyLoading() enabled in your AppServiceProvider, you'll catch it immediately. Worth enabling in local development if you haven't already.
A few of our Premium Examples: