Class: DorIndexing::Indexers::EmbargoMetadataIndexer

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

Overview

Indexes the embargo metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina:) ⇒ EmbargoMetadataIndexer

Returns a new instance of EmbargoMetadataIndexer.



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

def initialize(cocina:, **)
  @cocina = cocina
end

Instance Attribute Details

#cocinaObject (readonly)

Returns the value of attribute cocina.



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

def cocina
  @cocina
end

Instance Method Details

#to_solrHash

These fields are used by the EmbargoReleaseService in dor-services-app

Returns:

  • (Hash)

    the partial solr document for embargoMetadata



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

def to_solr
  {}.tap do |solr_doc|
    embargo_release_date = embargo_release_date(cocina)
    if embargo_release_date.present?
      solr_doc['embargo_status_ssim'] = ['embargoed']
      solr_doc['embargo_release_dtsim'] = [embargo_release_date.utc.iso8601]
    end
  end
end