Class: Dor::ProcessIndexer
- Inherits:
-
Object
- Object
- Dor::ProcessIndexer
- Defined in:
- lib/dor/indexers/process_indexer.rb
Overview
Indexes the process for a workflow
Instance Method Summary collapse
-
#initialize(solr_doc:, workflow_name:, process:) ⇒ ProcessIndexer
constructor
A new instance of ProcessIndexer.
-
#to_solr ⇒ Hash
The partial solr document for the workflow document.
Constructor Details
#initialize(solr_doc:, workflow_name:, process:) ⇒ ProcessIndexer
Returns a new instance of ProcessIndexer.
16 17 18 19 20 |
# File 'lib/dor/indexers/process_indexer.rb', line 16 def initialize(solr_doc:, workflow_name:, process:) @solr_doc = solr_doc @workflow_name = workflow_name @process = process end |
Instance Method Details
#to_solr ⇒ Hash
Returns the partial solr document for the workflow document.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dor/indexers/process_indexer.rb', line 23 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 has_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 |