Commit 06441e6b92584aed42a93b9ac3075372367bd8cf
1 parent
1c35e458
Exists in
master
and in
2 other branches
Less send [skip ci]
Showing
5 changed files
with
5 additions
and
10 deletions
Show diff stats
lib/searchkick/bulk_reindex_job.rb
@@ -14,9 +14,8 @@ module Searchkick | @@ -14,9 +14,8 @@ module Searchkick | ||
14 | relation = Searchkick.load_records(relation, record_ids) | 14 | relation = Searchkick.load_records(relation, record_ids) |
15 | relation = relation.search_import if relation.respond_to?(:search_import) | 15 | relation = relation.search_import if relation.respond_to?(:search_import) |
16 | 16 | ||
17 | - # TODO expose functionality on index | ||
18 | - index.send(:record_indexer).reindex(relation, mode: :inline, method_name: method_name, full: false) | ||
19 | - index.send(:relation_indexer).batch_completed(batch_id) if batch_id | 17 | + RecordIndexer.new(index).reindex(relation, mode: :inline, method_name: method_name, full: false) |
18 | + RelationIndexer.new(index).batch_completed(batch_id) if batch_id | ||
20 | end | 19 | end |
21 | end | 20 | end |
22 | end | 21 | end |
lib/searchkick/index.rb
@@ -301,10 +301,6 @@ module Searchkick | @@ -301,10 +301,6 @@ module Searchkick | ||
301 | @relation_indexer ||= RelationIndexer.new(self) | 301 | @relation_indexer ||= RelationIndexer.new(self) |
302 | end | 302 | end |
303 | 303 | ||
304 | - def record_indexer | ||
305 | - @record_indexer ||= RecordIndexer.new(self) | ||
306 | - end | ||
307 | - | ||
308 | def index_settings | 304 | def index_settings |
309 | settings.values.first["settings"]["index"] | 305 | settings.values.first["settings"]["index"] |
310 | end | 306 | end |
lib/searchkick/model.rb
@@ -28,7 +28,7 @@ module Searchkick | @@ -28,7 +28,7 @@ module Searchkick | ||
28 | def reindex(method_name = nil, mode: nil, refresh: false) | 28 | def reindex(method_name = nil, mode: nil, refresh: false) |
29 | mode ||= Searchkick.callbacks_value || self.class.searchkick_index.options[:callbacks] || true | 29 | mode ||= Searchkick.callbacks_value || self.class.searchkick_index.options[:callbacks] || true |
30 | mode = :inline if mode == :bulk | 30 | mode = :inline if mode == :bulk |
31 | - result = self.class.searchkick_index.send(:record_indexer).reindex([self], mode: mode, method_name: method_name, single: true) | 31 | + result = RecordIndexer.new(self.class.searchkick_index).reindex([self], mode: mode, method_name: method_name, single: true) |
32 | self.class.searchkick_index.refresh if refresh | 32 | self.class.searchkick_index.refresh if refresh |
33 | result | 33 | result |
34 | end | 34 | end |
lib/searchkick/process_batch_job.rb
@@ -14,7 +14,7 @@ module Searchkick | @@ -14,7 +14,7 @@ module Searchkick | ||
14 | end | 14 | end |
15 | 15 | ||
16 | relation = Searchkick.scope(model) | 16 | relation = Searchkick.scope(model) |
17 | - index.send(:record_indexer).reindex_items(relation, items, method_name: nil) | 17 | + RecordIndexer.new(index).reindex_items(relation, items, method_name: nil) |
18 | end | 18 | end |
19 | end | 19 | end |
20 | end | 20 | end |
lib/searchkick/reindex_v2_job.rb
@@ -11,7 +11,7 @@ module Searchkick | @@ -11,7 +11,7 @@ module Searchkick | ||
11 | # but keep for now for backwards compatibility | 11 | # but keep for now for backwards compatibility |
12 | model = model.unscoped if model.respond_to?(:unscoped) | 12 | model = model.unscoped if model.respond_to?(:unscoped) |
13 | items = [{id: id, routing: routing}] | 13 | items = [{id: id, routing: routing}] |
14 | - index.send(:record_indexer).reindex_items(model, items, method_name: method_name, single: true) | 14 | + RecordIndexer.new(index).reindex_items(model, items, method_name: method_name, single: true) |
15 | end | 15 | end |
16 | end | 16 | end |
17 | end | 17 | end |