Open aniplaylist opened 4 years ago
Correct. If both the model, and the aggregator are searchable that is the normal behaviour.
You really need to make the models searchable? If not, you can remove the Searchable
trait from those models, and the aggregator will still work consuming just one indexing operation per update.
Just tried removing the Searchable
trait from my model but MakeSearchable
job is not triggered anymore (not even once) and the entry I updated is removed from my index
That is because you probably forgot to call the bootSearchable
in your service provider as specified here: algolia.com/doc/framework-integration/laravel/advanced-use-cases/multiple-models-in-one-index/?language=php#aggregators---multiple-models-in-one-index.
I didn't forget 🤔
<?php
namespace App\Providers;
use App\Search\Results;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Results::bootSearchable();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
}
Hi @aniplaylist , just ran into the same issue.
Simply change the shouldBeSearchable
method on your Aggregator to make it look like this :
public function shouldBeSearchable()
{
return $this->model->shouldBeSearchable();
}
It could be useful to put this in the docs btw :-)
Thanks! We are aware of this issue, no ETA for having this on the package at the moment.
Hello,
I have just set up an Aggregator on my project with two Models in it.
Whenever I'm updating one of these two models the MakeSearchable Job is run twice :
Is this the expected behaviour? Isn't this consuming two indexing operations on Algolia instead of one?
Two jobs seen on Horizon :
Model :
Aggregator :