Class: Dor::WorkflowIndexer
- Inherits:
-
Object
- Object
- Dor::WorkflowIndexer
- Defined in:
- lib/dor/indexers/workflow_indexer.rb
Overview
Indexes the objects position in workflows
Instance Method Summary collapse
-
#initialize(workflow:) ⇒ WorkflowIndexer
constructor
A new instance of WorkflowIndexer.
-
#to_solr ⇒ Hash
The partial solr document for the workflow document.
Constructor Details
#initialize(workflow:) ⇒ WorkflowIndexer
Returns a new instance of WorkflowIndexer.
7 8 9 |
# File 'lib/dor/indexers/workflow_indexer.rb', line 7 def initialize(workflow:) @workflow = workflow end |
Instance Method Details
#to_solr ⇒ Hash
Returns the partial solr document for the workflow document.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dor/indexers/workflow_indexer.rb', line 12 def to_solr WorkflowSolrDocument.new do |solr_doc| solr_doc.name = workflow_name errors = 0 # The error count is used by the Report class in Argo processes.each do |process| ProcessIndexer.new(solr_doc: solr_doc, workflow_name: workflow_name, process: process).to_solr errors += 1 if process.status == 'error' end solr_doc.status = [workflow_name, workflow_status, errors, repository].join('|') end end |