# 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.
        );
    }
    
    ...
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://uccello.gitbook.io/doc/customize-your-application/search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
