Class: CDMDEXER::LoadWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/cdmdexer/load_worker.rb

Overview

Load Records into a solr index

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deletablesObject (readonly)

Returns the value of attribute deletables.



7
8
9
# File 'lib/cdmdexer/load_worker.rb', line 7

def deletables
  @deletables
end

#loader_klassObject



16
17
18
# File 'lib/cdmdexer/load_worker.rb', line 16

def loader_klass
  @loader_klass ||= Loader
end

#recordsObject (readonly)

Returns the value of attribute records.



7
8
9
# File 'lib/cdmdexer/load_worker.rb', line 7

def records
  @records
end

#solr_configObject (readonly)

Returns the value of attribute solr_config.



7
8
9
# File 'lib/cdmdexer/load_worker.rb', line 7

def solr_config
  @solr_config
end

#solr_klassObject



20
21
22
# File 'lib/cdmdexer/load_worker.rb', line 20

def solr_klass
  @solr_klass ||= DefaultSolr
end

Instance Method Details

#load!Object



24
25
26
27
28
# File 'lib/cdmdexer/load_worker.rb', line 24

def load!
  loader_klass.new(records: records,
                   deletable_ids: deletables,
                   solr_client: solr_client).load!
end

#perform(records = [], deletables = [], solr_config = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/cdmdexer/load_worker.rb', line 9

def perform(records = [], deletables = [], solr_config = {})
  @solr_config = solr_config.symbolize_keys
  @records     = records
  @deletables  = deletables
  load!
end