Class: DorIndexing::Indexers::WorkflowsIndexer

Inherits:
Object
  • Object
show all
Defined in:
lib/dor_indexing/indexers/workflows_indexer.rb

Overview

Indexes the object’s state in the most recent execution of every one of its workflows

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, workflow_client:) ⇒ WorkflowsIndexer

Returns a new instance of WorkflowsIndexer.



9
10
11
12
# File 'lib/dor_indexing/indexers/workflows_indexer.rb', line 9

def initialize(id:, workflow_client:, **)
  @id = id
  @workflow_client = workflow_client
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/dor_indexing/indexers/workflows_indexer.rb', line 7

def id
  @id
end

Instance Method Details

#to_solrHash

Returns the partial solr document for workflows concerns.

Returns:

  • (Hash)

    the partial solr document for workflows concerns



15
16
17
18
19
20
21
22
# File 'lib/dor_indexing/indexers/workflows_indexer.rb', line 15

def to_solr
  WorkflowSolrDocument.new do |combined_doc|
    workflows.each do |wf|
      doc = WorkflowIndexer.new(workflow: wf, workflow_client:).to_solr
      combined_doc.merge!(doc)
    end
  end.to_h
end