> For the complete documentation index, see [llms.txt](https://uccello.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://uccello.gitbook.io/doc/customize-your-application/search.md).

# Search

Uccello uses the library [spatie/laravel-searchable](https://github.com/spatie/laravel-searchable) to simplify the search for data.

You must configure the search for each model if you want :

* Make it possible to search for data from the global search.
* Make data search accessible from a list view for [Entity](/doc/uitypes-displaytypes/default-uitypes.md#entity) fields.

## Configuration

To activate the search in a module, please add the following code to the model related to this module:

```php
<?php

namespace App;

use Spatie\Searchable\Searchable;
use Spatie\Searchable\SearchResult;
use Illuminate\Database\Eloquent\Model;

class Person extends Model implements Searchable
{
    ...

    public $searchableType = 'domain'; // An unique key. Put here the domain's name.

    public $searchableColumns = [
        'name' // Replace by the attributes of the model in which you want to activate the search.
    ];

    public function getSearchResult(): SearchResult
    {
        return new SearchResult(
            $this,
            $this->recordLabel // The record label you want to display for the search results.
        );
    }
    
    ...
}
```
