---
title: Searching
---

# Searching

<div class="documentation__toc"></div>

## Introduction

The search system is integrated using [Laravel Scout](https://laravel.com/docs/5.8/scout).

[Laravel Scout Documentation](https://laravel.com/docs/5.8/scout){.link}

## Configuring

To begin indexing models you simply need to make the stream or model `searchable`.

### Via Control Panel

You can mark streams as `searchable` within the control panel in various areas.

### Via Migration

When creating a stream via migration you can set `searchable` to `true` to make the stream searchable.

[Streams Migrations](/documentation/streams-platform/latest/database/migrations#stream-migrations){.link}

### Via API

You can use the Streams repository to fetch a stream instance, set it's `searchable` attribute to `true` and then `saving` said stream instance.

```php
use \Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface;

$repository = app(StreamRepositoryInterface::class);

$stream = $repository->findBySlugAndNamespace('vehicles', 'rvs');

$stream->searchable = true;

$streams->save($stream);
```


## Indexing

In general indexing works exactly the same as it does in Scout.

[Scout Indexing](https://laravel.com/docs/5.8/scout#indexing){.link}

You also have access to a few other methods of indexing.

### Saving

Any time a searchable model is saved it will be synced automatically.

### Index Command

The `streams:index` Artisan command will flush and re-index all or specific streams.

[Index Command](/documentation/streams-platform/latest/reference/cli-commands#streams-index){.link}
