Module: Chewy::Index::Import

Extended by:
ActiveSupport::Concern
Included in:
Chewy::Index
Defined in:
lib/chewy/index/import.rb,
lib/chewy/index/import/routine.rb,
lib/chewy/index/import/bulk_builder.rb,
lib/chewy/index/import/bulk_request.rb,
lib/chewy/index/import/journal_builder.rb

Defined Under Namespace

Modules: ClassMethods Classes: BulkBuilder, BulkRequest, JournalBuilder, Routine

Constant Summary collapse

IMPORT_WORKER =
lambda do |index, options, total, ids, iteration|
  ::Process.setproctitle("chewy [#{index}]: import data (#{iteration + 1}/#{total})")
  routine = Routine.new(index, **options)
  index.adapter.import(*ids, routine.options) do |action_objects|
    routine.process(**action_objects)
  end
  {errors: routine.errors, import: routine.stats, leftovers: routine.leftovers}
end
LEFTOVERS_WORKER =
lambda do |index, options, total, body, iteration|
  ::Process.setproctitle("chewy [#{index}]: import leftovers (#{iteration + 1}/#{total})")
  routine = Routine.new(index, **options)
  routine.perform_bulk(body)
  routine.errors
end