Laravel 5.4, Scout & Algolia Indicies Update

Hi all,

I’m using Laravel Scout, Algolia and vue-instantsearch to search in my application. Everything is working great. The only sticking point I have is when deleting a model. My understanding is that when a model is deleted scout will update algolia and then in turn update my indices. Once a model is deleted I redirect back to the route which has my vue component for searching, but the route requires me to hard refresh to see any updates to my search list.

Any thoughts on what the issue may be?


I answered on stackoverflow:

1 Like

Thanks @julienbourdeau. Any thoughts on subscribing to model events and changing the view once deleted has fired. I’m not sure if the eloquent model subscribes to events in Algolia?

The event will be thrown when it’s deleted from the DB, then Scout will trigger the event in Algolia. But the only way to know it was deleted from Algolia is to call the api check the TaskID.

The task ID is returned by Algolia clients but scout will not pass it along.

I’m not sure what the best way would be here. I’ll think about it.

Can you describe your usecase in details?
I assume it’s some sort of admin where the user can interact with the results (like a listing page where you delete/update), is it?

Right now, the only think I can think is not trivial. You could pass to your frontend the recently deleted item and hide it, or something similar.