You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your searchable allows for it, you may want to consider adding support for query scopes, which we now recommend over filtering.
601
+
602
+
```php
603
+
$query = Thing::query();
604
+
605
+
$this->applyQueryScope($query);
606
+
607
+
return $query->pluck('reference');
608
+
```
609
+
610
+
If you support filtering, you may want to split the "with filter" & "without filter" cases into separate return statements.
611
+
612
+
The `->filter()` method evaluates every item in the collection, which is an unnecessary performance hit when no filter is configured:
613
+
614
+
```php
615
+
$query = Thing::query();
616
+
617
+
if ($this->hasFilter()) {
618
+
return $query
619
+
->lazy(config('statamic.search.chunk_size'))
620
+
->filter($this->filter())
621
+
->values()
622
+
->map->reference();
623
+
}
624
+
625
+
return $query->pluck('reference');
626
+
```
627
+
628
+
### Search: Changes to custom search drivers
629
+
630
+
The `insertDocument` method is now public:
631
+
632
+
```php
633
+
protected function insertDocuments(Documents $documents) // [tl! remove]
634
+
public function insertDocuments(Documents $documents) // [tl! add]
635
+
```
636
+
637
+
If you were previously overriding the `insertMultiple` method to chunk documents, you don't need to do that anymore (chunking is now handled by the base method).
638
+
639
+
If you need to manipulate the fields array before it gets sent to your index, you may define a `fields` method:
640
+
641
+
```php
642
+
public function fields(Searchable $searchable)
643
+
{
644
+
return array_merge(
645
+
$this->searchables()->fields($searchable),
646
+
[
647
+
'_some_special_field_' => $searchable->id(),
648
+
]
649
+
);
650
+
}
651
+
```
652
+
591
653
### Bard: Strikes now output `<strike>` tags, rather than `<s>`
592
654
**Affects apps relying on the `<s>` tag for strikes.**
0 commit comments