#Laravel Scout import relationship with queue ?

1 messages · Page 1 of 1 (latest)

torn hamlet
#

Hello guys,

At this moment on the documentation, it's specified that we relationships will not work when importing items with Laravel Scout. But do you know another way to do that ?
Because in my case, I absolutely need to use queue (because I have more than 4M+ items to import with relationships)...

inland horizon
#

What do you mean? The docs just mention that eager loaded relationships won't be eager loaded when running in a queue. You can still use them, they will just be lazy loaded.

torn hamlet
#

But lazy loaded for +3M entries ?
I have more than 5 relations to load, so it's 3.000.000*5 requests for an import ? uh

inland horizon
#

You could override Scout:: $makeSearchableJob with a custom job class that eager loads the relationships.

inland horizon
#

But if importing millions of models is a one time thing, why not just create an artisan command that disables queuing and then calls scout:import?