Class: Esse::AsyncIndexing::Actions::UpsertDocument
- Inherits:
-
Object
- Object
- Esse::AsyncIndexing::Actions::UpsertDocument
- Defined in:
- lib/esse/async_indexing/actions/upsert_document.rb
Constant Summary collapse
- DOC_ARGS =
%i[lazy_attributes]
Class Method Summary collapse
-
.call(index_class_name, repo_name, document_id, operation = "index", options = {}) ⇒ Object
OPERATIONS = %w[index update delete].
Class Method Details
.call(index_class_name, repo_name, document_id, operation = "index", options = {}) ⇒ Object
OPERATIONS = %w[index update delete]
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/esse/async_indexing/actions/upsert_document.rb', line 8 def self.call(index_class_name, repo_name, document_id, operation = "index", = {}) case operation when "delete" DeleteDocument.call(index_class_name, repo_name, document_id, ) when "update" result = UpdateDocument.call(index_class_name, repo_name, document_id, ) return result if result != :not_found DeleteDocument.call(index_class_name, repo_name, document_id, ) when "index" result = IndexDocument.call(index_class_name, repo_name, document_id, ) return result if result != :not_found DeleteDocument.call(index_class_name, repo_name, document_id, ) else raise ArgumentError, "operation must be one of index, update, delete" end end |