Commit 3d8bfbd3736f8c536b4ea08deb3f26f15da5cea0

Authored by Andrew Kane
1 parent ca1951c1

Show id when indexing single item [skip ci]

Showing 1 changed file with 5 additions and 1 deletions   Show diff stats
lib/searchkick/logging.rb
... ... @@ -19,9 +19,10 @@ module Searchkick
19 19 def bulk_index(records)
20 20 if records.any?
21 21 event = {
22   - name: "#{records.first.searchkick_klass.name} Import",
  22 + name: "#{records.first.searchkick_klass.name} Index",
23 23 count: records.size
24 24 }
  25 + event[:id] = search_id(records.first) if records.size == 1
25 26 if Searchkick.callbacks_value == :bulk
26 27 super
27 28 else
... ... @@ -31,6 +32,7 @@ module Searchkick
31 32 end
32 33 end
33 34 end
  35 + alias_method :import, :bulk_index
34 36  
35 37 def bulk_update(records, *args)
36 38 if records.any?
... ... @@ -38,6 +40,7 @@ module Searchkick
38 40 name: "#{records.first.searchkick_klass.name} Update",
39 41 count: records.size
40 42 }
  43 + event[:id] = search_id(records.first) if records.size == 1
41 44 if Searchkick.callbacks_value == :bulk
42 45 super
43 46 else
... ... @@ -54,6 +57,7 @@ module Searchkick
54 57 name: "#{records.first.searchkick_klass.name} Delete",
55 58 count: records.size
56 59 }
  60 + event[:id] = search_id(records.first) if records.size == 1
57 61 if Searchkick.callbacks_value == :bulk
58 62 super
59 63 else
... ...