Commit 089ebf639fd64bcc671afab35f41ea58f8cc5e51

Authored by Andrew Kane
1 parent ae0da31c

Log updates and deletes

Showing 2 changed files with 28 additions and 0 deletions   Show diff stats
CHANGELOG.md
  1 +## 2.0.5 [unreleased]
  2 +
  3 +- Log updates and deletes
  4 +
1 5 ## 2.0.4
2 6  
3 7 - Added support for queuing updates [experimental]
... ...
lib/searchkick/logging.rb
... ... @@ -56,6 +56,30 @@ module Searchkick
56 56 end
57 57 end
58 58 end
  59 +
  60 + def bulk_update(records, *args)
  61 + if records.any?
  62 + event = {
  63 + name: "#{records.first.searchkick_klass.name} Update",
  64 + count: records.size
  65 + }
  66 + ActiveSupport::Notifications.instrument("request.searchkick", event) do
  67 + super(records, *args)
  68 + end
  69 + end
  70 + end
  71 +
  72 + def bulk_delete(records)
  73 + if records.any?
  74 + event = {
  75 + name: "#{records.first.searchkick_klass.name} Delete",
  76 + count: records.size
  77 + }
  78 + ActiveSupport::Notifications.instrument("request.searchkick", event) do
  79 + super(records)
  80 + end
  81 + end
  82 + end
59 83 end
60 84  
61 85 module IndexerWithInstrumentation
... ...