Class: Dor::ProcessIndexer

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/indexers/process_indexer.rb

Overview

Indexes the process for a workflow

Instance Method Summary collapse

Constructor Details

#initialize(solr_doc:, workflow_name:, process:) ⇒ ProcessIndexer

Returns a new instance of ProcessIndexer.

Parameters:



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_solrHash

Returns the partial solr document for the workflow document.

Returns:

  • (Hash)

    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?

  index_error_message

  # 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