scout-extended
scout-extended copied to clipboard
$model->searchable() does not update aggregates
I'm not sure if this is just a limitation of this package, but when calling searchable() or unsearchable() directly on a Model, any aggregators that the Model is part of do not get updated.
Not sure if there is an easy fix for this, but for now we just do the following...
$user = User::find(16);
$user->searchable();
\App\Search\UserAggregate::create($user)->searchable();
@JayBizzle Have you added this into your service provider?
\App\Search\UserAggregate::bootSearchable();
Yes, we have done that 👍
@JayBizzle Can you try investigate the bug please?
Isn't the issue that the Aggregates register Model event listeners, and get fired when Models are saved and updated etc, but when calling $model->searchable() or $model->unsearchable() the Model doesn't actually change, so no events are fired, hence the Aggregate doesn't get updated?