Algolia Update Index On Relational Database change with Laravel Scout -


i have implemented aloglia movies table actors relational table , works fine.

problem:

when update movie updating algolia index (its good). how can update index if made change in relational table (for example update actor of movie).

how push specific record manually laravel scout.

thanks

the issue lies in laravel's events. whats happening scout listening 'updated' event occurs in laravel when model object saved , dirty (aka value differ in db).

there 2 ways can this.

the bad lazy way add ->touch() model prior save - force updated_at field update , trigger updated event. bad you're wasting db query.

the second , preferable way register observer on 'saved' triggers regardless of whether or not object dirty. either want check if model dirty , index when not (to prevent double indexing updated event) or de-register 'updated' listener comes in scout.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -