Class: DorIndexing::Indexers::IdentityMetadataIndexer

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

Overview

Indexes the identity metadata from cocina.identification

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina:) ⇒ IdentityMetadataIndexer

Returns a new instance of IdentityMetadataIndexer.



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

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

Instance Attribute Details

#cocina_objectObject (readonly)

Returns the value of attribute cocina_object.



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

def cocina_object
  @cocina_object
end

Instance Method Details

#to_solrHash

rubocop:disable Metrics/MethodLength

Returns:

  • (Hash)

    the partial solr document for identityMetadata



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dor_indexing/indexers/identity_metadata_indexer.rb', line 15

def to_solr
  return { 'objectType_ssim' => [object_type] } if object_type == 'adminPolicy' || cocina_object.identification.blank?

  {
    'objectType_ssim' => [object_type],
    'identifier_ssim' => prefixed_identifiers, # sourceid, barcode, folio_instance_hrid for display
    'identifier_tesim' => prefixed_identifiers, # ditto ^^, for search, tokenized (can search prefix and value as separate tokens)
    'barcode_id_ssim' => [barcode].compact,
    'source_id_ssi' => source_id, # for search and display (reports, track_sheet)
    'source_id_text_nostem_i' => source_id, # for search, tokenized per request from accessioneers
    'folio_instance_hrid_ssim' => [folio_instance_hrid].compact,
    'doi_ssim' => [doi].compact
  }
end