Skip to content
This repository was 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
clovenlife wants to merge 3 commits into
babenkoivan:masterfrom
clovenlife:master
Open

Allow BulkIndexer to load relations efficiently when called from a queue#212
clovenlife wants to merge 3 commits into
babenkoivan:masterfrom
clovenlife:master

Conversation

@clovenlife

Copy link
Copy Markdown

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