Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions content/collections/pages/5-to-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,31 @@ $globalSet->in('en')->data(['foo' => 'bar'])->save(); // [tl! add]
$globalSet->in('en')->delete(); // [tl! add]
```

### Search: `'searchables' => 'all'`
**Affects apps using `'searchables' => 'all'` in their search config.**

Previously, you could set `'searchables' => 'all'` on a search index to include entries, terms, assets, users and anything provided by [custom searchables](/frontend/search#custom-searchables).

However, in v6, to split out search between the frontend and the Control Panel, support for `'searchable' => 'all'` has been removed.

You can now either use `'searchables' => 'content'` - which includes entries, terms and assets (**not** users) - or explicitly list [the searchables](/frontend/search#searchables) you want:

```php
// config/statamic/search.php

'indexes' => [

'default' => [
'driver' => 'local',
'searchables' => ['collection:blog', 'taxonomy:categories', 'assets:*'],
'fields' => ['title'],
],

],
```

We’ve avoided automating this migration so you can intentionally decide whether users should be included.

### Breadcrumbs
**Affects apps or addons displaying breadcrumbs in the Control Panel.**

Expand Down
49 changes: 43 additions & 6 deletions content/collections/pages/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Your site's default index includes _only_ the title from _all_ collections. The
``` php
'default' => [
'driver' => 'local',
'searchables' => 'all',
'searchables' => 'content',
'fields' => ['title'],
],
```
Expand Down Expand Up @@ -294,7 +294,7 @@ de:
'indexes' => [
'default' => [
'driver' => 'local',
'searchables' => 'all',
'searchables' => 'content',
]
]
```
Expand All @@ -305,7 +305,7 @@ By default, all entries will go into the `default` index, regardless of what sit
'indexes' => [
'default' => [
'driver' => 'local',
'searchables' => 'all',
'searchables' => 'content',
'sites' => ['en', 'fr'], // You can also use "all" [tl! ++ **]
]
]
Expand Down Expand Up @@ -337,7 +337,7 @@ You may provide local driver specific settings in a `settings` array.

```php
'driver' => 'local',
'searchables' => 'all',
'searchables' => 'content',
// [tl! **:start]
'min_characters' => 3,
'use_stemming' => true,
Expand Down Expand Up @@ -381,7 +381,7 @@ Algolia is a full-featured search and navigation cloud service. They offer fast
``` php
'default' => [
'driver' => 'algolia',
'searchables' => 'all',
'searchables' => 'content',
],
```

Expand All @@ -403,7 +403,7 @@ You may provide Algolia-specific [settings](https://www.algolia.com/doc/api-refe

```php
'driver' => 'algolia',
'searchables' => 'all',
'searchables' => 'content',
'settings' => [ // [tl! **:start]
'attributesForFaceting' => [
'filterOnly(post_tags)',
Expand Down Expand Up @@ -434,6 +434,31 @@ You can also add values to the drivers array, which will cascade down to any ind
Any values you add to an individual index will only be applied there.


## Control Panel

Statamic configures a `cp` search index behind the scenes, used by the Command Palette.

By default, it uses the `local` driver and includes content (entries/terms/assets), users, and any addon-provided searchables.

You can override the configuration in your `search.php` config file:

```php
// config/statamic/search.php

'indexes' => [

// ...

'cp' => [
'driver' => 'local',
'searchables' => ['content', 'users', 'addons'],
'fields' => ['title'],
],

],
```


## Digging deeper

Search is split into a handful of different parts behind the scenes.
Expand Down Expand Up @@ -621,6 +646,18 @@ public function boot()
]
```

You can also include your searchable in the `content` or `addons` wildcard searchables, which are used by default for front-end and Control Panel searches.

```php
// Pass the handle...
Search::addContentSearchable('product');
Search::addCpSearchable('order');

// Or the provider class...
Search::addContentSearchable(ProductsProvider::class);
Search::addCpSearchable(OrdersProvider::class);
```

#### Event Listeners

You will want to update the indexes when you create, edit, or delete your searchable items.
Expand Down