scout-elasticsearch-driver
scout-elasticsearch-driver copied to clipboard
Allow BulkIndexer to load relations efficiently when called from a queue
trafficstars
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