Class: DorIndexing::Builders::EventDateBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dor_indexing/builders/event_date_builder.rb

Overview

Builds the event date fields for a solr document

Class Method Summary collapse

Class Method Details

.build(event, date_type) ⇒ String?

Returns the date value for Solr.

Parameters:

  • event (Cocina::Models::Event)

    single selected event

Returns:

  • (String, nil)

    the date value for Solr



9
10
11
12
13
14
15
# File 'lib/dor_indexing/builders/event_date_builder.rb', line 9

def self.build(event, date_type)
  event_dates = Array(event&.date) + Array(event&.parallelEvent&.map(&:date))

  matching_date_value_with_status_primary(event_dates, date_type) ||
    matching_date_value(event_dates, date_type) ||
    untyped_date_value(event_dates)
end