Class: DorIndexing::Indexers::WorkflowProcessIndexer
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::WorkflowProcessIndexer
- Defined in:
- lib/dor_indexing/indexers/workflow_process_indexer.rb
Overview
Creates solr doc fields (and values) for a process for a workflow (which is for an object)
Instance Method Summary collapse
-
#initialize(solr_doc:, workflow_name:, process:) ⇒ WorkflowProcessIndexer
constructor
A new instance of WorkflowProcessIndexer.
-
#to_solr ⇒ Hash
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(solr_doc:, workflow_name:, process:) ⇒ WorkflowProcessIndexer
Returns a new instance of WorkflowProcessIndexer.
17 18 19 20 21 |
# File 'lib/dor_indexing/indexers/workflow_process_indexer.rb', line 17 def initialize(solr_doc:, workflow_name:, process:) @solr_doc = solr_doc @workflow_name = workflow_name @process = process end |
Instance Method Details
#to_solr ⇒ Hash
rubocop:disable Metrics/AbcSize
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dor_indexing/indexers/workflow_process_indexer.rb', line 25 def to_solr return unless status # add a record of the robot having operated on this item, so we can track robot activity solr_doc.add_process_time(workflow_name, name, Time.parse(process.datetime)) if time? # workflow name, process status then process name solr_doc.add_wsp("#{workflow_name}:#{status}", "#{workflow_name}:#{status}:#{name}") # workflow name, process name then process status solr_doc.add_wps("#{workflow_name}:#{name}", "#{workflow_name}:#{name}:#{status}") # process status, workflowname then process name solr_doc.add_swp(process.status.to_s, "#{status}:#{workflow_name}", "#{status}:#{workflow_name}:#{name}") end |