Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Allow BulkIndexer to load relations efficiently when called from a queue #212

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

clovenlife
Copy link

Because Scout passes all models through MakeSerachable class when using a queue. The class uses the SerializesModels trait and any eager loaded relations will no longer be present when the queued job is run.

Since these relations are gone, BulkIndexer causes a query for every model when it reaches toSearchableArray(). By adding loadMissing and passing in desired relations via a property on the model class loads relations for that chunk without adding cost to single threaded uses

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant