Skip to content

Commit

Permalink
Add a traject setting for component_identifier_format
Browse files Browse the repository at this point in the history
  • Loading branch information
marlo-longley committed Dec 11, 2023
1 parent 67e9dcc commit 9ed8336
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#
# NOTE: All fields should be stored in Solr
# ==================
to_field 'ref_ssi' do |record, accumulator, _context|
to_field 'ref_ssi' do |record, accumulator, context|
next if context.output_hash['ref_ssi']

accumulator << if record.attribute('id').blank?
Expand Down Expand Up @@ -97,8 +97,7 @@

data = {
ref_id: context.output_hash['ref_ssi']&.first,
root_id: settings[:root].output_hash['id']&.first,
repository: settings[:root].settings[:repository]
root_id: settings[:root].output_hash['id']&.first
}

accumulator << (settings[:component_identifier_format] % data)
Expand Down Expand Up @@ -301,6 +300,7 @@
provide :counter, context.settings[:counter]
provide :depth, context.settings[:depth].to_i + 1
provide :component_traject_config, context.settings[:component_traject_config]
provide :component_identifier_format, context.settings[:component_identifier_format]
end

i.load_config_file(context.settings[:component_traject_config])
Expand Down
2 changes: 0 additions & 2 deletions lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
provide 'repository', ENV.fetch('REPOSITORY_ID', nil)
provide 'logger', Logger.new($stderr)
provide 'component_traject_config', File.join(__dir__, 'ead2_component_config.rb')
# provide 'component_identifier_format', '%{root_id}%{ref_id}'
end

each_record do |_record, context|
Expand Down Expand Up @@ -277,7 +276,6 @@ def increment
provide :depth, 1
provide :logger, context.settings[:logger]
provide :component_traject_config, context.settings[:component_traject_config]
provide :component_identifier_format, context.settings[:component_identifier_format] if context.settings[:component_identifier_format]
end

i.load_config_file(context.settings[:component_traject_config])
Expand Down

0 comments on commit 9ed8336

Please sign in to comment.