# [Usage](../../../../usage.md) > [Components](../../basics.md) > [Visuals](../../basics.md) > [Table](../table.md) > customGlobalSearch

### `customGlobalSearch` | `->setCustomGlobalSearch()`
Set a closure to filter the query in addition to the usual global search. The result will be `OR` between the standard global search of the columns that have enabled the `->setSearchable()` and this custom query.

The closure can receive the `$query` and the `$search` as arguments, the `$search` is the search term on the global search:
```php
\KFramework\Components\Visual\Table::make()
    ->setCustomGlobalSearch(function ($query, $search) {
        return $query->where('name', 'like', "%{$search}%");
    })
```

| Types     | Default |
|-----------|---------|
| `Closure` | `null`  |

What it does: extends the global search box for dynamic tables (`setQuery()` required). The standard search already scans every [searchable column](tablecolumn_searchable.md) with a case-insensitive LIKE (plus JSON fallback); this closure adds extra conditions and the final result is the UNION (`OR`) of both ID sets (see `applySearchFilters()` in `TableHelper`). Static (`values`) tables ignore it.

Minimal working example — Blade:
```php
{!!
    \KFramework\Components\Visual\Table::make()
        ->setSchema([
            \KFramework\Components\Visual\TableColumn::make('name')->setLabel('Name')->setSearchable(),
        ])
        ->setQuery($usersQuery)
        ->setCustomGlobalSearch(function ($query, $search) {
            return $query->where('code', 'like', "%{$search}%");
        })
!!}
```
Controller:
```php
Table::make()
    ->setSchema([TableColumn::make('name')->setLabel('Name')->setSearchable()])
    ->setQuery(User::query())
    ->setCustomGlobalSearch(fn ($query, $search) => $query->where('code', 'like', "%{$search}%"));
```
What the user sees: typing in the single search box matches both the searchable columns and the extra `code` condition.

Interaction:
- Pairs with [searchable columns](tablecolumn_searchable.md) (which columns the built-in half covers) and [custom filters](table_customfilters.md) (free-text vs structured form filters, applied together).
- Combine with [query](table_query.md) + [pageable](table_pageable.md): search re-counts `recordsFiltered` server-side.
- Active terms appear as removable badges alongside [SearchBuilder indicators](table_customfilters.md).

See also: [Table](../table.md), [Components basics](../../basics.md), [searchable](tablecolumn_searchable.md), [custom filters](table_customfilters.md).