Search code examples
laravelalgoliasearchablelaravel-scout

laravel scout when does shouldBeSearchable get triggered


Lets say I have a shouldBeSearchable() set like this:

public function shouldBeSearchable()
{
    return $this->is_active === 1;
}

By default in my app a newly created post gets is_active set to 1 so it will be added to my search index.

But if I now update that same post and set is_active to 0 does it automatically then get removed from my search index?


Solution

  • Yes, it should. 👍 If it doesn't work, it will be a bug.