module Searchkick::IndexWithInstrumentation

Public Instance Methods

bulk_delete(records) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 97
def bulk_delete(records)
  if records.any?
    event = {
      name: "#{records.first.searchkick_klass.name} Delete",
      count: records.size
    }
    event[:id] = search_id(records.first) if records.size == 1
    if Searchkick.callbacks_value == :bulk
      super
    else
      ActiveSupport::Notifications.instrument("request.searchkick", event) do
        super
      end
    end
  end
end
bulk_index(records) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 62
def bulk_index(records)
  if records.any?
    event = {
      name: "#{records.first.searchkick_klass.name} Import",
      count: records.size
    }
    event[:id] = search_id(records.first) if records.size == 1
    if Searchkick.callbacks_value == :bulk
      super
    else
      ActiveSupport::Notifications.instrument("request.searchkick", event) do
        super
      end
    end
  end
end
Also aliased as: import
bulk_update(records, *args) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 80
def bulk_update(records, *args)
  if records.any?
    event = {
      name: "#{records.first.searchkick_klass.name} Update",
      count: records.size
    }
    event[:id] = search_id(records.first) if records.size == 1
    if Searchkick.callbacks_value == :bulk
      super
    else
      ActiveSupport::Notifications.instrument("request.searchkick", event) do
        super
      end
    end
  end
end
import(records)
Alias for: bulk_index
remove(record) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 33
def remove(record)
  name = record && record.searchkick_klass ? "#{record.searchkick_klass.name} Remove" : "Remove"
  event = {
    name: name,
    id: search_id(record)
  }
  if Searchkick.callbacks_value == :bulk
    super
  else
    ActiveSupport::Notifications.instrument("request.searchkick", event) do
      super
    end
  end
end
store(record) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 19
def store(record)
  event = {
    name: "#{record.searchkick_klass.name} Store",
    id: search_id(record)
  }
  if Searchkick.callbacks_value == :bulk
    super
  else
    ActiveSupport::Notifications.instrument("request.searchkick", event) do
      super
    end
  end
end
update_record(record, method_name) click to toggle source
Calls superclass method
# File lib/searchkick/logging.rb, line 48
def update_record(record, method_name)
  event = {
    name: "#{record.searchkick_klass.name} Update",
    id: search_id(record)
  }
  if Searchkick.callbacks_value == :bulk
    super
  else
    ActiveSupport::Notifications.instrument("request.searchkick", event) do
      super
    end
  end
end