Class: Esse::AsyncIndexing::Actions::DeleteDocument

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

Constant Summary collapse

DOC_ARGS =
%i[lazy_attributes]

Class Method Summary collapse

Class Method Details

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



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

def self.call(index_class_name, repo_name, document_id, options = {})
  index_class, _repo_class = CoerceIndexRepository.call(index_class_name, repo_name)
  bulk_opts = Esse::HashUtils.deep_transform_keys(options, &:to_sym)
  bulk_opts.delete_if { |k, _| DOC_ARGS.include?(k) }

  index_class.delete(id: document_id, **bulk_opts)
  :deleted
end