Commit b7e9b5bcd8c2ea3f31a02afae5c4e265dc3e564b
1 parent
0d8b5166
Exists in
master
and in
19 other branches
Make reindex_scope private [skip ci]
Showing
1 changed file
with
36 additions
and
36 deletions
Show diff stats
lib/searchkick/index.rb
... | ... | @@ -226,6 +226,42 @@ module Searchkick |
226 | 226 | response["hits"]["total"] |
227 | 227 | end |
228 | 228 | |
229 | + def import_scope(scope, **options) | |
230 | + bulk_indexer.import_scope(scope, **options) | |
231 | + end | |
232 | + | |
233 | + def batches_left | |
234 | + bulk_indexer.batches_left | |
235 | + end | |
236 | + | |
237 | + # other | |
238 | + | |
239 | + def tokens(text, options = {}) | |
240 | + client.indices.analyze(body: {text: text}.merge(options), index: name)["tokens"].map { |t| t["token"] } | |
241 | + end | |
242 | + | |
243 | + def klass_document_type(klass, ignore_type = false) | |
244 | + @klass_document_type[[klass, ignore_type]] ||= begin | |
245 | + if !ignore_type && klass.searchkick_klass.searchkick_options[:_type] | |
246 | + type = klass.searchkick_klass.searchkick_options[:_type] | |
247 | + type = type.call if type.respond_to?(:call) | |
248 | + type | |
249 | + else | |
250 | + klass.model_name.to_s.underscore | |
251 | + end | |
252 | + end | |
253 | + end | |
254 | + | |
255 | + protected | |
256 | + | |
257 | + def client | |
258 | + Searchkick.client | |
259 | + end | |
260 | + | |
261 | + def bulk_indexer | |
262 | + @bulk_indexer ||= BulkIndexer.new(self) | |
263 | + end | |
264 | + | |
229 | 265 | # https://gist.github.com/jarosan/3124884 |
230 | 266 | # http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/ |
231 | 267 | def reindex_scope(scope, import: true, resume: false, retain: false, async: false, refresh_interval: nil) |
... | ... | @@ -291,41 +327,5 @@ module Searchkick |
291 | 327 | |
292 | 328 | raise e |
293 | 329 | end |
294 | - | |
295 | - def import_scope(scope, **options) | |
296 | - bulk_indexer.import_scope(scope, **options) | |
297 | - end | |
298 | - | |
299 | - def batches_left | |
300 | - bulk_indexer.batches_left | |
301 | - end | |
302 | - | |
303 | - # other | |
304 | - | |
305 | - def tokens(text, options = {}) | |
306 | - client.indices.analyze(body: {text: text}.merge(options), index: name)["tokens"].map { |t| t["token"] } | |
307 | - end | |
308 | - | |
309 | - def klass_document_type(klass, ignore_type = false) | |
310 | - @klass_document_type[[klass, ignore_type]] ||= begin | |
311 | - if !ignore_type && klass.searchkick_klass.searchkick_options[:_type] | |
312 | - type = klass.searchkick_klass.searchkick_options[:_type] | |
313 | - type = type.call if type.respond_to?(:call) | |
314 | - type | |
315 | - else | |
316 | - klass.model_name.to_s.underscore | |
317 | - end | |
318 | - end | |
319 | - end | |
320 | - | |
321 | - protected | |
322 | - | |
323 | - def client | |
324 | - Searchkick.client | |
325 | - end | |
326 | - | |
327 | - def bulk_indexer | |
328 | - @bulk_indexer ||= BulkIndexer.new(self) | |
329 | - end | |
330 | 330 | end |
331 | 331 | end | ... | ... |