Skip to content

Commit

Permalink
Handles collection when indexing identity metadata.
Browse files Browse the repository at this point in the history
closes #550
  • Loading branch information
justinlittman committed Mar 25, 2021
1 parent 50a683d commit d72ef84
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Gemfile.lock
Expand Up @@ -252,7 +252,8 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mimemagic (0.3.6)
mimemagic (0.3.8)
nokogiri (~> 1)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.14.4)
Expand Down
2 changes: 1 addition & 1 deletion app/indexers/identity_metadata_indexer.rb
Expand Up @@ -33,7 +33,7 @@ def source_id_value
end

def barcode
@barcode ||= cocina_object.identification.barcode
@barcode ||= object_type != 'collection' ? cocina_object.identification.barcode : nil
end

def catkey
Expand Down
27 changes: 27 additions & 0 deletions spec/indexers/identity_metadata_indexer_spec.rb
Expand Up @@ -74,5 +74,32 @@
)
end
end

context 'with a collection' do
let(:type) { Cocina::Models::Vocab.collection }
let(:identification) do
{
sourceId: 'google:STANFORD_342837261527',
catalogLinks: [
{
catalog: 'symphony',
catalogRecordId: '129483625'
}
]
}
end

it 'has the fields used by argo' do
expect(doc).to include(
'barcode_id_ssim' => [],
'catkey_id_ssim' => ['129483625'],
'dor_id_tesim' => %w[STANFORD_342837261527 129483625],
'identifier_ssim' => ['google:STANFORD_342837261527', 'catkey:129483625'],
'identifier_tesim' => ['google:STANFORD_342837261527', 'catkey:129483625'],
'objectType_ssim' => ['collection'],
'source_id_ssim' => ['google:STANFORD_342837261527']
)
end
end
end
end

0 comments on commit d72ef84

Please sign in to comment.