Searching
Introduction
The search system is integrated using Laravel Scout.
Laravel Scout Documentation{.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{.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.
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{.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{.link}