Module: Workarea::Tasks::Search

Extended by:
Search
Included in:
Search
Defined in:
lib/workarea/tasks/search.rb

Instance Method Summary collapse

Instance Method Details

#index_adminObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/workarea/tasks/search.rb', line 11

def index_admin
  Workarea::QueuesPauser.with_paused_queues do
    Workarea::Search::Admin.reset_indexes!
  end

  Mongoid.models.each do |klass|
    next unless Workarea::Search::Admin.for(klass.first).present?

    klass.all.each_slice_of(Workarea.config.bulk_index_batch_size) do |models|
      Workarea::BulkIndexAdmin.perform_by_models(models)
    end
  end

  Workarea.config.jump_to_navigation.to_a.each do |tuple|
    Workarea::Search::Admin::Navigation.new(tuple).save
  end
end

#index_helpObject



43
44
45
46
47
48
49
50
51
# File 'lib/workarea/tasks/search.rb', line 43

def index_help
  Workarea::QueuesPauser.with_paused_queues do
    Workarea::Search::Help.reset_indexes!
  end

  Workarea::Help::Article.all.each_by(Workarea.config.bulk_index_batch_size) do |help_article|
    Workarea::Search::Help.new(help_article).save
  end
end

#index_storefrontObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/workarea/tasks/search.rb', line 29

def index_storefront
  Workarea::QueuesPauser.with_paused_queues do
    Workarea::Search::Storefront.reset_indexes!
    Workarea::Search::Storefront.ensure_dynamic_mappings
  end

  ensure_dynamic_mappings_for_current_product_filters

  index_storefront_categories
  index_storefront_content_pages
  index_storefront_products
  index_storefront_searches
end

#setupObject



6
7
8
9
# File 'lib/workarea/tasks/search.rb', line 6

def setup
  require 'sidekiq/testing/inline' unless ENV['INLINE'] == 'false'
  Workarea.config.bulk_index_batch_size = ENV['BATCH_SIZE'].to_i if ENV['BATCH_SIZE'].present?
end