diff --git a/lib/arclight/traject/ead2_config.rb b/lib/arclight/traject/ead2_config.rb index 8e6d66a2f..69491edd4 100644 --- a/lib/arclight/traject/ead2_config.rb +++ b/lib/arclight/traject/ead2_config.rb @@ -79,9 +79,10 @@ to_field 'id' do |record, accumulator| id = record.at_xpath('/ead/eadheader/eadid')&.text + unitid = record.at_xpath('/ead/archdesc/did/unitid')&.text title = record.at_xpath('/ead/archdesc/did/unittitle')&.text repository = settings['repository'] - accumulator << settings['id_normalizer'].constantize.new(id, title: title, repository: repository).to_s + accumulator << settings['id_normalizer'].constantize.new(id, unitid: unitid, title: title, repository: repository).to_s end to_field 'title_filing_ssi', extract_xpath('/ead/eadheader/filedesc/titlestmt/titleproper[@type="filing"]') diff --git a/spec/lib/arclight/normalized_id_spec.rb b/spec/lib/arclight/normalized_id_spec.rb index abcb99e3c..2527bbd8e 100644 --- a/spec/lib/arclight/normalized_id_spec.rb +++ b/spec/lib/arclight/normalized_id_spec.rb @@ -33,7 +33,9 @@ end context 'when additional keyword arguments are supplied' do - subject(:normalized_id) { described_class.new('abc123.xml', title: 'a title', repository: 'repo').to_s } + subject(:normalized_id) do + described_class.new('abc123.xml', unitid: 'abc-123', title: 'a title', repository: 'repo').to_s + end it 'accepts the additional arguments without changing the output' do expect(normalized_id).to eq 'abc123-xml'