Commit bfe5dd1a33b701e53f650af634cb119a81ea9e17
1 parent
b6694113
Exists in
master
and in
2 other branches
Improved naming and code [skip ci]
Showing
1 changed file
with
4 additions
and
5 deletions
Show diff stats
lib/searchkick/index.rb
@@ -209,7 +209,7 @@ module Searchkick | @@ -209,7 +209,7 @@ module Searchkick | ||
209 | 209 | ||
210 | # reindex | 210 | # reindex |
211 | 211 | ||
212 | - def reindex(relation, method_name, scoped:, full: false, scope: nil, **options) | 212 | + def reindex(relation, method_name, scoped:, full: false, **options) |
213 | refresh = options.fetch(:refresh, !scoped) | 213 | refresh = options.fetch(:refresh, !scoped) |
214 | options.delete(:refresh) | 214 | options.delete(:refresh) |
215 | 215 | ||
@@ -218,12 +218,11 @@ module Searchkick | @@ -218,12 +218,11 @@ module Searchkick | ||
218 | raise ArgumentError, "unsupported keywords: #{options.keys.map(&:inspect).join(", ")}" if options.any? | 218 | raise ArgumentError, "unsupported keywords: #{options.keys.map(&:inspect).join(", ")}" if options.any? |
219 | 219 | ||
220 | # import only | 220 | # import only |
221 | - import_scope(relation, method_name: method_name, scope: scope, mode: mode) | 221 | + import_scope(relation, method_name: method_name, mode: mode) |
222 | self.refresh if refresh | 222 | self.refresh if refresh |
223 | true | 223 | true |
224 | else | 224 | else |
225 | - # full reindex | ||
226 | - reindex_scope(relation, scope: scope, **options) | 225 | + full_reindex(relation, **options) |
227 | end | 226 | end |
228 | end | 227 | end |
229 | 228 | ||
@@ -317,7 +316,7 @@ module Searchkick | @@ -317,7 +316,7 @@ module Searchkick | ||
317 | # https://gist.github.com/jarosan/3124884 | 316 | # https://gist.github.com/jarosan/3124884 |
318 | # http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/ | 317 | # http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/ |
319 | # TODO deprecate async in favor of mode: :async, wait: true/false | 318 | # TODO deprecate async in favor of mode: :async, wait: true/false |
320 | - def reindex_scope(relation, import: true, resume: false, retain: false, async: false, refresh_interval: nil, scope: nil) | 319 | + def full_reindex(relation, import: true, resume: false, retain: false, async: false, refresh_interval: nil, scope: nil) |
321 | if resume | 320 | if resume |
322 | index_name = all_indices.sort.last | 321 | index_name = all_indices.sort.last |
323 | raise Searchkick::Error, "No index to resume" unless index_name | 322 | raise Searchkick::Error, "No index to resume" unless index_name |