Class: Esse::AsyncIndexing::Actions::BatchImport

Inherits:
Object
  • Object
show all
Defined in:
lib/esse/async_indexing/actions/batch_import.rb

Class Method Summary collapse

Class Method Details

.call(index_class_name, repo_name, ids, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/esse/async_indexing/actions/batch_import.rb', line 5

def self.call(index_class_name, repo_name, ids, options = {})
  ids = Array(ids)
  return if ids.empty?

  _index_class, repo_class = CoerceIndexRepository.call(index_class_name, repo_name)
  kwargs = Esse::HashUtils.deep_transform_keys(options, &:to_sym)
  kwargs[:context] ||= {}
  kwargs[:context][:id] = ids
  repo_class.import(**kwargs)
end