class Searchkick::Indexer
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/searchkick/indexer.rb, line 16 def perform items = @queued_items @queued_items = [] return if items.empty? response = Searchkick.client.bulk(body: items) if response["errors"] # note: delete does not set error when item not found first_with_error = response["items"].map do |item| (item["index"] || item["delete"] || item["update"]) end.find { |item| item["error"] } raise ImportError, "#{first_with_error["error"]} on item with id '#{first_with_error["_id"]}'" end # maybe return response in future nil end
Source
# File lib/searchkick/indexer.rb, line 11 def queue(items) @queued_items.concat(items) perform unless Searchkick.callbacks_value == :bulk end