arclight 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.all-contributorsrc +450 -0
  3. data/.babelrc +3 -0
  4. data/.codeclimate.yml +5 -0
  5. data/.eslintrc +3 -0
  6. data/.rubocop.yml +19 -0
  7. data/.rubocop_todo.yml +15 -135
  8. data/.travis.yml +2 -2
  9. data/CONTRIBUTORS.md +79 -0
  10. data/README.md +21 -24
  11. data/Rakefile +0 -1
  12. data/app/assets/images/blacklight/bookmark.svg +1 -0
  13. data/app/assets/images/blacklight/collection.svg +5 -0
  14. data/app/assets/images/blacklight/compact.svg +1 -25
  15. data/app/assets/images/blacklight/container.svg +5 -0
  16. data/app/assets/images/blacklight/ead.svg +1 -0
  17. data/app/assets/images/blacklight/file.svg +5 -0
  18. data/app/assets/images/blacklight/folder.svg +1 -0
  19. data/app/assets/images/blacklight/list.svg +1 -0
  20. data/app/assets/images/blacklight/minus.svg +1 -0
  21. data/app/assets/images/blacklight/online.svg +5 -0
  22. data/app/assets/images/blacklight/pdf.svg +1 -0
  23. data/app/assets/images/blacklight/plus.svg +1 -0
  24. data/app/assets/images/blacklight/repository.svg +1 -0
  25. data/app/assets/javascripts/arclight/arclight.js +1 -3
  26. data/app/assets/javascripts/arclight/collection_navigation.js +36 -53
  27. data/app/assets/javascripts/arclight/collection_scrollspy.js +1 -1
  28. data/app/assets/javascripts/arclight/context_navigation.js +374 -0
  29. data/app/assets/javascripts/arclight/truncator.js.erb +8 -2
  30. data/app/assets/stylesheets/arclight/application.scss +3 -1
  31. data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +23 -0
  32. data/app/assets/stylesheets/arclight/modules/context_navigation.scss +75 -0
  33. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +28 -35
  34. data/app/assets/stylesheets/arclight/modules/highlights.scss +2 -1
  35. data/app/assets/stylesheets/arclight/modules/layout.scss +128 -14
  36. data/app/assets/stylesheets/arclight/modules/mastheads.scss +27 -5
  37. data/app/assets/stylesheets/arclight/modules/repositories.scss +1 -5
  38. data/app/assets/stylesheets/arclight/modules/repository_card.scss +6 -7
  39. data/app/assets/stylesheets/arclight/modules/search_results.scss +145 -24
  40. data/app/assets/stylesheets/arclight/modules/show_collection.scss +38 -59
  41. data/app/assets/stylesheets/arclight/responsive.scss +13 -0
  42. data/app/assets/stylesheets/arclight/variables.scss +21 -1
  43. data/app/controllers/concerns/arclight/ead_format_helpers.rb +225 -0
  44. data/app/controllers/concerns/arclight/field_config_helpers.rb +23 -7
  45. data/app/factories/blacklight_field_configuration_factory.rb +1 -0
  46. data/app/helpers/arclight_helper.rb +197 -35
  47. data/app/models/arclight/document_downloads.rb +125 -0
  48. data/app/models/arclight/parent.rb +4 -2
  49. data/app/models/arclight/parents.rb +6 -4
  50. data/app/models/arclight/requests/aeon_external_request.rb +42 -0
  51. data/app/models/arclight/requests/aeon_web_ead.rb +47 -0
  52. data/app/models/arclight/requests/google_form.rb +2 -2
  53. data/app/models/concerns/arclight/catalog.rb +14 -2
  54. data/app/models/concerns/arclight/search_behavior.rb +27 -12
  55. data/app/models/concerns/arclight/solr_document.rb +29 -7
  56. data/app/views/arclight/_requests.html.erb +7 -0
  57. data/app/views/arclight/repositories/_in_person_repository.html.erb +1 -1
  58. data/app/views/arclight/repositories/_repository.html.erb +2 -2
  59. data/app/views/arclight/repositories/_repository_contact.html.erb +9 -0
  60. data/app/views/arclight/repositories/index.html.erb +3 -0
  61. data/app/views/arclight/repositories/show.html.erb +5 -4
  62. data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +9 -0
  63. data/app/views/arclight/requests/_aeon_web_ead.html.erb +7 -0
  64. data/app/views/arclight/requests/_google_form.html.erb +2 -1
  65. data/app/views/arclight/viewers/_oembed.html.erb +2 -1
  66. data/app/views/catalog/_access_contents.html.erb +15 -0
  67. data/app/views/catalog/_arclight_abstract_or_scope.html.erb +5 -0
  68. data/app/views/catalog/_arclight_bookmark_control.html.erb +38 -0
  69. data/app/views/catalog/_arclight_document_header_icon.html.erb +1 -0
  70. data/app/views/catalog/_arclight_index_compact_default.html.erb +18 -11
  71. data/app/views/catalog/_arclight_index_default.html.erb +45 -0
  72. data/app/views/catalog/_arclight_index_group_document_compact_default.html.erb +19 -0
  73. data/app/views/catalog/_arclight_index_group_document_default.html.erb +18 -0
  74. data/app/views/catalog/_arclight_online_content_indicator.html.erb +1 -3
  75. data/app/views/catalog/_collection_contents.html.erb +2 -10
  76. data/app/views/catalog/_collection_context.html.erb +15 -0
  77. data/app/views/catalog/_collection_context_nav.html.erb +12 -0
  78. data/app/views/catalog/_collection_online_contents.html.erb +3 -3
  79. data/app/views/catalog/_component_context.html.erb +5 -0
  80. data/app/views/catalog/_containers.html.erb +3 -0
  81. data/app/views/catalog/_context_sidebar.html.erb +2 -2
  82. data/app/views/catalog/_document_downloads.html.erb +14 -0
  83. data/app/views/catalog/_group.html.erb +21 -0
  84. data/app/views/catalog/_group_header_compact_default.html.erb +15 -0
  85. data/app/views/catalog/_group_header_default.html.erb +20 -0
  86. data/app/views/catalog/_group_toggle.html.erb +10 -0
  87. data/app/views/catalog/_home.html.erb +1 -1
  88. data/app/views/catalog/_index_breadcrumb_default.html.erb +5 -2
  89. data/app/views/catalog/_index_collection_context_default.html.erb +53 -0
  90. data/app/views/catalog/_index_header.html.erb +3 -3
  91. data/app/views/catalog/_index_online_contents_default.html.erb +1 -1
  92. data/app/views/catalog/_online_content_label.html.erb +5 -0
  93. data/app/views/catalog/_search_form.html.erb +34 -0
  94. data/app/views/catalog/_search_results.html.erb +1 -4
  95. data/app/views/catalog/_show_actions_box_default.html.erb +27 -0
  96. data/app/views/catalog/_show_breadcrumbs_default.html.erb +5 -20
  97. data/app/views/catalog/_show_collection.html.erb +42 -24
  98. data/app/views/catalog/_show_default.html.erb +63 -35
  99. data/app/views/catalog/_show_upper_metadata_default.html.erb +1 -1
  100. data/app/views/catalog/_sort_and_per_page.html.erb +8 -0
  101. data/app/views/catalog/_within_collection_dropdown.html.erb +26 -0
  102. data/app/views/shared/_breadcrumbs.html.erb +4 -4
  103. data/app/views/shared/_context_sidebar.html.erb +2 -2
  104. data/app/views/shared/_header_navbar.html.erb +13 -17
  105. data/app/views/shared/_show_breadcrumbs.html.erb +27 -0
  106. data/arclight.gemspec +5 -6
  107. data/config/i18n-tasks.yml +2 -1
  108. data/config/locales/arclight.en.yml +54 -21
  109. data/config/repositories.yml +0 -0
  110. data/lib/arclight/engine.rb +22 -12
  111. data/lib/arclight/hash_absolute_xpath.rb +11 -7
  112. data/lib/arclight/level_label.rb +46 -0
  113. data/lib/arclight/normalized_date.rb +2 -2
  114. data/lib/arclight/normalized_id.rb +1 -0
  115. data/lib/arclight/normalized_title.rb +1 -0
  116. data/lib/arclight/repository.rb +58 -5
  117. data/lib/arclight/traject/ead2_config.rb +178 -159
  118. data/lib/arclight/traject/nokogiri_namespaceless_reader.rb +22 -0
  119. data/lib/arclight/version.rb +1 -1
  120. data/lib/arclight/viewers/oembed.rb +1 -0
  121. data/lib/arclight/year_range.rb +9 -1
  122. data/lib/generators/arclight/install_generator.rb +5 -1
  123. data/lib/generators/arclight/templates/catalog_controller.rb +128 -100
  124. data/lib/generators/arclight/templates/config/downloads.yml +12 -0
  125. data/lib/generators/arclight/templates/config/repositories.yml +20 -2
  126. data/lib/generators/arclight/update_generator.rb +1 -1
  127. data/lib/tasks/index.rake +18 -20
  128. data/package.json +8 -1
  129. data/solr/conf/schema.xml +51 -292
  130. data/solr/conf/solrconfig.xml +40 -125
  131. data/tasks/arclight.rake +1 -0
  132. data/vendor/assets/javascripts/responsiveTruncator.js +2 -2
  133. metadata +71 -44
  134. data/app/assets/javascripts/arclight/collection_context.js +0 -18
  135. data/app/assets/javascripts/arclight/component_ancestors.js +0 -56
  136. data/app/assets/javascripts/arclight/search_results.js +0 -15
  137. data/app/assets/stylesheets/arclight/modules/sidebar.scss +0 -21
  138. data/app/views/catalog/_collection_count.html.erb +0 -7
  139. data/app/views/catalog/_collection_downloads.html.erb +0 -15
  140. data/app/views/catalog/_collection_overview.html.erb +0 -7
  141. data/app/views/catalog/_component_contents.html.erb +0 -16
  142. data/app/views/catalog/_component_overview.html.erb +0 -40
  143. data/app/views/catalog/_index_header_hierarchy_default.html.erb +0 -42
  144. data/app/views/catalog/_index_hierarchy_default.html.erb +0 -28
  145. data/app/views/catalog/_results_histogram.html.erb +0 -15
  146. data/app/views/catalog/_show_component_sidebar.html.erb +0 -12
  147. data/app/views/catalog/_show_sidebar.html.erb +0 -22
  148. data/lib/arclight/custom_component.rb +0 -99
  149. data/lib/arclight/custom_document.rb +0 -93
  150. data/lib/arclight/indexer.rb +0 -9
  151. data/lib/arclight/shared_indexing_behavior.rb +0 -97
  152. data/lib/arclight/shared_terminology_behavior.rb +0 -65
  153. data/lib/arclight/solr_ead_indexer_ext.rb +0 -155
@@ -47,8 +47,8 @@ module Arclight
47
47
  else
48
48
  result = nil
49
49
  end
50
- return if result.blank?
51
- result.strip
50
+
51
+ result&.strip
52
52
  end
53
53
  end
54
54
  end
@@ -19,6 +19,7 @@ module Arclight
19
19
 
20
20
  def normalize
21
21
  raise Arclight::Exceptions::IDNotFound if id.blank?
22
+
22
23
  id.strip.tr('.', '-')
23
24
  end
24
25
  end
@@ -24,6 +24,7 @@ module Arclight
24
24
  def normalize
25
25
  result = [title, date].compact.join(', ')
26
26
  raise Arclight::Exceptions::TitleNotFound if result.blank?
27
+
27
28
  result
28
29
  end
29
30
  end
@@ -26,6 +26,57 @@ module Arclight
26
26
  [city, state_zip, country].compact.join(', ')
27
27
  end
28
28
 
29
+ # Why are we using self#respond_to? below?
30
+ #
31
+ # All the keys in the config hash from `repositories.yml` are
32
+ # on-the-fly added as attr_accessors up in #initialize. If the
33
+ # request_types key isn't present, the method won't be created.
34
+ #
35
+ # Since the original data is thrown away, this is the best way
36
+ # to see if that key was present.
37
+ def request_config_present?
38
+ return false unless respond_to? :request_types
39
+ return false if request_types.nil? || request_types.empty?
40
+
41
+ request_configs = request_types.map { |_k, v| v }
42
+ request_configs[0]&.fetch('request_url').present? &&
43
+ request_configs[0]&.fetch('request_mappings').present?
44
+ end
45
+
46
+ def request_config_present_for_type?(type)
47
+ return false unless type && request_config_present?
48
+
49
+ config = request_types[type]
50
+ config&.fetch('request_url').present? &&
51
+ config&.fetch('request_mappings').present?
52
+ end
53
+
54
+ def request_config_for_type(type)
55
+ return nil unless type && request_config_present_for_type?(type)
56
+
57
+ request_types[type]
58
+ end
59
+
60
+ def request_url_for_type(type)
61
+ return nil unless type && request_config_present_for_type?(type)
62
+
63
+ config = request_config_for_type(type)
64
+ config.fetch('request_url')
65
+ end
66
+
67
+ def request_mappings_for_type(type)
68
+ return nil unless type && request_config_present_for_type?(type)
69
+
70
+ config = request_config_for_type(type)
71
+ config.fetch('request_mappings')
72
+ end
73
+
74
+ def available_request_types
75
+ return [] unless request_types.present?
76
+
77
+ request_types.keys
78
+ end
79
+
29
80
  # Load repository information from a YAML file
30
81
  #
31
82
  # @param [String] `filename`
@@ -42,19 +93,20 @@ module Arclight
42
93
  # Mimics ActiveRecord's `all` behavior
43
94
  #
44
95
  # @return [Array<Repository>]
45
- def self.all
46
- from_yaml(ENV['REPOSITORY_FILE'] || 'config/repositories.yml').values
96
+ def self.all(yaml_file = nil)
97
+ yaml_file = ENV['REPOSITORY_FILE'] || 'config/repositories.yml' if yaml_file.nil?
98
+ from_yaml(yaml_file).values
47
99
  end
48
100
 
49
101
  # Mimics ActiveRecord dynamic `find_by` behavior for the slug or name
50
102
  #
51
103
  # @param [String] `slug` or `name`
52
104
  # @return [Repository]
53
- def self.find_by(slug: nil, name: nil)
105
+ def self.find_by(slug: nil, name: nil, yaml_file: nil)
54
106
  if slug
55
- all.find { |repo| repo.slug == slug }
107
+ all(yaml_file).find { |repo| repo.slug == slug }
56
108
  elsif name
57
- all.find { |repo| repo.name == name }
109
+ all(yaml_file).find { |repo| repo.name == name }
58
110
  else
59
111
  raise ArgumentError, 'Requires either slug or name parameters to find_by'
60
112
  end
@@ -68,6 +120,7 @@ module Arclight
68
120
  def self.find_by!(*args)
69
121
  repository = find_by(*args)
70
122
  raise ActiveRecord::RecordNotFound if repository.blank?
123
+
71
124
  repository
72
125
  end
73
126
  end
@@ -5,6 +5,7 @@ require 'traject'
5
5
  require 'traject/nokogiri_reader'
6
6
  require 'traject_plus'
7
7
  require 'traject_plus/macros'
8
+ require 'arclight/level_label'
8
9
  require 'arclight/normalized_date'
9
10
  require 'arclight/normalized_title'
10
11
  require 'active_model/conversion' ## Needed for Arclight::Repository
@@ -13,13 +14,14 @@ require 'arclight/digital_object'
13
14
  require 'arclight/year_range'
14
15
  require 'arclight/repository'
15
16
  require 'arclight/missing_id_strategy'
16
-
17
- NAME_ELEMENTS = %w[corpname famname name persname].freeze
17
+ require 'arclight/traject/nokogiri_namespaceless_reader'
18
18
 
19
19
  # rubocop:disable Style/MixinUsage
20
20
  extend TrajectPlus::Macros
21
21
  # rubocop:enable Style/MixinUsage
22
22
 
23
+ NAME_ELEMENTS = %w[corpname famname name persname].freeze
24
+
23
25
  SEARCHABLE_NOTES_FIELDS = %w[
24
26
  accessrestrict
25
27
  accruals
@@ -50,8 +52,7 @@ DID_SEARCHABLE_NOTES_FIELDS = %w[
50
52
  ].freeze
51
53
 
52
54
  settings do
53
- provide 'nokogiri.namespaces',
54
- 'xmlns' => 'urn:isbn:1-931666-22-9'
55
+ provide 'reader_class_name', 'Arclight::Traject::NokogiriNamespacelessReader'
55
56
  provide 'solr_writer.commit_on_close', 'true'
56
57
  provide 'repository', ENV['REPOSITORY_ID']
57
58
  provide 'logger', Logger.new($stderr)
@@ -65,28 +66,38 @@ each_record do |_record, context|
65
66
  ).name
66
67
  end
67
68
 
68
- # Top level
69
- to_field 'id', extract_xpath('//xmlns:eadid'), strip, gsub('.', '-')
70
- to_field 'title_filing_si', extract_xpath('//xmlns:titleproper[@type="filing"]')
71
- to_field 'title_ssm', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unittitle')
72
- to_field 'title_teim', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unittitle')
73
- to_field 'ead_ssi', extract_xpath('//xmlns:eadid')
69
+ # ==================
70
+ # Top level document
71
+ # ==================
74
72
 
75
- to_field 'unitdate_ssm', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitdate')
76
- to_field 'unitdate_bulk_ssim', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitdate[@type="bulk"]')
77
- to_field 'unitdate_inclusive_ssm', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitdate[@type="inclusive"]')
78
- to_field 'unitdate_other_ssim', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitdate[not(@type)]')
73
+ to_field 'id', extract_xpath('/ead/eadheader/eadid'), strip, gsub('.', '-')
74
+ to_field 'title_filing_si', extract_xpath('/ead/eadheader/filedesc/titlestmt/titleproper[@type="filing"]')
75
+ to_field 'title_ssm', extract_xpath('/ead/archdesc/did/unittitle')
76
+ to_field 'title_teim', extract_xpath('/ead/archdesc/did/unittitle')
77
+ to_field 'ead_ssi', extract_xpath('/ead/eadheader/eadid')
79
78
 
80
- to_field 'level_ssm' do |record, accumulator|
81
- accumulator << record.at_xpath('//xmlns:archdesc').attribute('level').value
79
+ to_field 'unitdate_ssm', extract_xpath('/ead/archdesc/did/unitdate')
80
+ to_field 'unitdate_bulk_ssim', extract_xpath('/ead/archdesc/did/unitdate[@type="bulk"]')
81
+ to_field 'unitdate_inclusive_ssm', extract_xpath('/ead/archdesc/did/unitdate[@type="inclusive"]')
82
+ to_field 'unitdate_other_ssim', extract_xpath('/ead/archdesc/did/unitdate[not(@type)]')
83
+
84
+ # All top-level docs treated as 'collection' for routing / display purposes
85
+ to_field 'level_ssm' do |_record, accumulator|
86
+ accumulator << 'collection'
82
87
  end
83
88
 
89
+ # Keep the original top-level archdesc/@level for Level facet in addition to 'Collection'
84
90
  to_field 'level_sim' do |record, accumulator|
85
- accumulator << record.at_xpath('//xmlns:archdesc').attribute('level').value&.capitalize
91
+ level = record.at_xpath('/ead/archdesc').attribute('level')&.value
92
+ other_level = record.at_xpath('/ead/archdesc').attribute('otherlevel')&.value
93
+
94
+ accumulator << Arclight::LevelLabel.new(level, other_level).to_s
95
+ accumulator << 'Collection' unless level == 'collection'
86
96
  end
87
97
 
88
- to_field 'unitid_ssm', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitid')
89
- to_field 'unitid_teim', extract_xpath('//xmlns:archdesc/xmlns:did/xmlns:unitid')
98
+ to_field 'unitid_ssm', extract_xpath('/ead/archdesc/did/unitid')
99
+ to_field 'unitid_teim', extract_xpath('/ead/archdesc/did/unitid')
100
+ to_field 'collection_unitid_ssm', extract_xpath('/ead/archdesc/did/unitid')
90
101
 
91
102
  to_field 'normalized_title_ssm' do |_record, accumulator, context|
92
103
  dates = Arclight::NormalizedDate.new(
@@ -112,6 +123,12 @@ end
112
123
  to_field 'collection_sim' do |_record, accumulator, context|
113
124
  accumulator.concat context.output_hash.fetch('normalized_title_ssm', [])
114
125
  end
126
+ to_field 'collection_ssi' do |_record, accumulator, context|
127
+ accumulator.concat context.output_hash.fetch('normalized_title_ssm', [])
128
+ end
129
+ to_field 'collection_title_tesim' do |_record, accumulator, context|
130
+ accumulator.concat context.output_hash.fetch('normalized_title_ssm', [])
131
+ end
115
132
 
116
133
  to_field 'repository_ssm' do |_record, accumulator, context|
117
134
  accumulator << context.clipboard[:repository]
@@ -121,26 +138,25 @@ to_field 'repository_sim' do |_record, accumulator, context|
121
138
  accumulator << context.clipboard[:repository]
122
139
  end
123
140
 
124
- to_field 'geogname_ssm', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:geogname')
125
-
126
- to_field 'geogname_sim', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:geogname')
141
+ to_field 'geogname_ssm', extract_xpath('/ead/archdesc/controlaccess/geogname')
142
+ to_field 'geogname_sim', extract_xpath('/ead/archdesc/controlaccess/geogname')
127
143
 
128
- to_field 'creator_ssm', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']")
129
- to_field 'creator_sim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']")
130
- to_field 'creator_ssim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']")
144
+ to_field 'creator_ssm', extract_xpath('/ead/archdesc/did/origination')
145
+ to_field 'creator_sim', extract_xpath('/ead/archdesc/did/origination')
146
+ to_field 'creator_ssim', extract_xpath('/ead/archdesc/did/origination')
131
147
  to_field 'creator_sort' do |record, accumulator|
132
- accumulator << record.xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']").map { |c| c.text.strip }.join(', ')
148
+ accumulator << record.xpath('/ead/archdesc/did/origination').map { |c| c.text.strip }.join(', ')
133
149
  end
134
150
 
135
- to_field 'creator_persname_ssm', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:persname")
136
- to_field 'creator_persname_ssim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:persname")
137
- to_field 'creator_corpname_ssm', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:corpname")
138
- to_field 'creator_corpname_sim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:corpname")
139
- to_field 'creator_corpname_ssim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:corpname")
140
- to_field 'creator_famname_ssm', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:famname")
141
- to_field 'creator_famname_ssim', extract_xpath("//xmlns:archdesc/xmlns:did/xmlns:origination[@label='creator']/xmlns:famname")
151
+ to_field 'creator_persname_ssm', extract_xpath('/ead/archdesc/did/origination/persname')
152
+ to_field 'creator_persname_ssim', extract_xpath('/ead/archdesc/did/origination/persname')
153
+ to_field 'creator_corpname_ssm', extract_xpath('/ead/archdesc/did/origination/corpname')
154
+ to_field 'creator_corpname_sim', extract_xpath('/ead/archdesc/did/origination/corpname')
155
+ to_field 'creator_corpname_ssim', extract_xpath('/ead/archdesc/did/origination/corpname')
156
+ to_field 'creator_famname_ssm', extract_xpath('/ead/archdesc/did/origination/famname')
157
+ to_field 'creator_famname_ssim', extract_xpath('/ead/archdesc/did/origination/famname')
142
158
 
143
- to_field 'persname_sim', extract_xpath('//xmlns:persname')
159
+ to_field 'persname_sim', extract_xpath('//persname')
144
160
 
145
161
  to_field 'creators_ssim' do |_record, accumulator, context|
146
162
  accumulator.concat context.output_hash['creator_persname_ssm'] if context.output_hash['creator_persname_ssm']
@@ -148,27 +164,19 @@ to_field 'creators_ssim' do |_record, accumulator, context|
148
164
  accumulator.concat context.output_hash['creator_famname_ssm'] if context.output_hash['creator_famname_ssm']
149
165
  end
150
166
 
151
- to_field 'places_sim', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:geogname')
152
- to_field 'places_ssim', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:geogname')
153
- to_field 'places_ssm', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:geogname')
167
+ to_field 'places_sim', extract_xpath('/ead/archdesc/controlaccess/geogname')
168
+ to_field 'places_ssim', extract_xpath('/ead/archdesc/controlaccess/geogname')
169
+ to_field 'places_ssm', extract_xpath('/ead/archdesc/controlaccess/geogname')
154
170
 
155
- to_field 'access_terms_ssm', extract_xpath('//xmlns:archdesc/xmlns:userestrict/xmlns:p')
171
+ to_field 'access_terms_ssm', extract_xpath('/ead/archdesc/userestrict/*[local-name()!="head"]')
156
172
 
157
- # Indexes the acquisition group information into the notes field
158
- # Please see https://www.loc.gov/ead/tglib/elements/acqinfo.html
159
- to_field 'acqinfo_ssim', extract_xpath('/xmlns:ead/xmlns:archdesc/xmlns:acqinfo/*[local-name()!="head"]')
160
- to_field 'acqinfo_ssim', extract_xpath('/xmlns:ead/xmlns:archdesc/xmlns:descgrp/xmlns:acqinfo/*[local-name()!="head"]')
161
- to_field 'acqinfo_ssim', extract_xpath('./xmlns:acqinfo/*[local-name()!="head"]')
162
- to_field 'acqinfo_ssim', extract_xpath('./xmlns:descgrp/xmlns:acqinfo/*[local-name()!="head"]')
163
- to_field 'acqinfo_ssm' do |_record, accumulator, context|
164
- accumulator.concat(context.output_hash.fetch('acqinfo_ssim', []))
165
- end
173
+ to_field 'acqinfo_ssim', extract_xpath('/ead/archdesc/acqinfo/*[local-name()!="head"]')
174
+ to_field 'acqinfo_ssim', extract_xpath('/ead/archdesc/descgrp/acqinfo/*[local-name()!="head"]')
166
175
 
167
- # Indexes only specified controlled terms for archival description into the access_subject field
168
- to_field 'access_subjects_ssim', extract_xpath('//xmlns:archdesc/xmlns:controlaccess', to_text: false) do |_record, accumulator|
176
+ to_field 'access_subjects_ssim', extract_xpath('/ead/archdesc/controlaccess', to_text: false) do |_record, accumulator|
169
177
  accumulator.map! do |element|
170
178
  %w[subject function occupation genreform].map do |selector|
171
- element.xpath(".//xmlns:#{selector}").map(&:text)
179
+ element.xpath(".//#{selector}").map(&:text)
172
180
  end
173
181
  end.flatten!
174
182
  end
@@ -177,16 +185,25 @@ to_field 'access_subjects_ssm' do |_record, accumulator, context|
177
185
  accumulator.concat Array.wrap(context.output_hash['access_subjects_ssim'])
178
186
  end
179
187
 
180
- to_field 'has_online_content_ssim', extract_xpath('.//xmlns:dao') do |_record, accumulator|
188
+ to_field 'has_online_content_ssim', extract_xpath('.//dao') do |_record, accumulator|
181
189
  accumulator.replace([accumulator.any?])
182
190
  end
183
191
 
184
- to_field 'extent_ssm', extract_xpath('//xmlns:did/xmlns:physdesc/xmlns:extent')
185
- to_field 'extent_teim', extract_xpath('//xmlns:did/xmlns:physdesc/xmlns:extent')
186
- to_field 'genreform_sim', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:genreform')
187
- to_field 'genreform_ssm', extract_xpath('//xmlns:archdesc/xmlns:controlaccess/xmlns:genreform')
192
+ to_field 'digital_objects_ssm', extract_xpath('/ead/archdesc/did/dao|/ead/archdesc/dao', to_text: false) do |_record, accumulator|
193
+ accumulator.map! do |dao|
194
+ label = dao.attributes['title']&.value ||
195
+ dao.xpath('daodesc/p')&.text
196
+ href = (dao.attributes['href'] || dao.attributes['xlink:href'])&.value
197
+ Arclight::DigitalObject.new(label: label, href: href).to_json
198
+ end
199
+ end
188
200
 
189
- to_field 'date_range_sim', extract_xpath('.//xmlns:did/xmlns:unitdate/@normal', to_text: false) do |_record, accumulator|
201
+ to_field 'extent_ssm', extract_xpath('/ead/archdesc/did/physdesc/extent')
202
+ to_field 'extent_teim', extract_xpath('/ead/archdesc/did/physdesc/extent')
203
+ to_field 'genreform_sim', extract_xpath('/ead/archdesc/controlaccess/genreform')
204
+ to_field 'genreform_ssm', extract_xpath('/ead/archdesc/controlaccess/genreform')
205
+
206
+ to_field 'date_range_sim', extract_xpath('/ead/archdesc/did/unitdate/@normal', to_text: false) do |_record, accumulator|
190
207
  range = Arclight::YearRange.new
191
208
  next range.years if accumulator.blank?
192
209
 
@@ -196,26 +213,33 @@ to_field 'date_range_sim', extract_xpath('.//xmlns:did/xmlns:unitdate/@normal',
196
213
  end
197
214
 
198
215
  SEARCHABLE_NOTES_FIELDS.map do |selector|
199
- to_field "#{selector}_ssm", extract_xpath("//xmlns:archdesc/xmlns:#{selector}/*[local-name()!='head']")
200
- to_field "#{selector}_heading_ssm", extract_xpath("//xmlns:archdesc/xmlns:#{selector}/xmlns:head") unless selector == 'prefercite'
201
- to_field "#{selector}_teim", extract_xpath("//xmlns:archdesc/xmlns:#{selector}/*[local-name()!='head']")
216
+ to_field "#{selector}_ssm", extract_xpath("/ead/archdesc/#{selector}/*[local-name()!='head']", to_text: false)
217
+ to_field "#{selector}_heading_ssm", extract_xpath("/ead/archdesc/#{selector}/head") unless selector == 'prefercite'
218
+ to_field "#{selector}_teim", extract_xpath("/ead/archdesc/#{selector}/*[local-name()!='head']")
202
219
  end
203
220
 
204
221
  DID_SEARCHABLE_NOTES_FIELDS.map do |selector|
205
- to_field "#{selector}_ssm", extract_xpath("//xmlns:did/xmlns:#{selector}")
222
+ to_field "#{selector}_ssm", extract_xpath("/ead/archdesc/did/#{selector}", to_text: false)
206
223
  end
224
+
207
225
  NAME_ELEMENTS.map do |selector|
208
- to_field 'names_coll_ssim', extract_xpath("/xmlns:ead/xmlns:archdesc/xmlns:controlaccess/xmlns:#{selector}")
209
- to_field 'names_ssim', extract_xpath("//xmlns:#{selector}")
210
- to_field "#{selector}_ssm", extract_xpath("//xmlns:#{selector}")
226
+ to_field 'names_coll_ssim', extract_xpath("/ead/archdesc/controlaccess/#{selector}")
227
+ to_field 'names_ssim', extract_xpath("//#{selector}")
228
+ to_field "#{selector}_ssm", extract_xpath("//#{selector}")
211
229
  end
212
- to_field 'corpname_sim', extract_xpath('//xmlns:corpname')
213
230
 
214
- to_field 'language_sim', extract_xpath('//xmlns:did/xmlns:langmaterial')
215
- to_field 'language_ssm', extract_xpath('//xmlns:did/xmlns:langmaterial')
231
+ to_field 'corpname_sim', extract_xpath('//corpname')
232
+
233
+ to_field 'language_sim', extract_xpath('/ead/archdesc/did/langmaterial')
234
+ to_field 'language_ssm', extract_xpath('/ead/archdesc/did/langmaterial')
235
+
236
+ to_field 'descrules_ssm', extract_xpath('/ead/eadheader/profiledesc/descrules')
216
237
 
238
+ # =============================
217
239
  # Each component child document
218
240
  # <c> <c01> <c12>
241
+ # =============================
242
+
219
243
  compose 'components', ->(record, accumulator, _context) { accumulator.concat record.xpath('//*[is_component(.)]', NokogiriXpathExtensions.new) } do
220
244
  to_field 'ref_ssi' do |record, accumulator, context|
221
245
  accumulator << if record.attribute('id').blank?
@@ -224,10 +248,12 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
224
248
  parent_id = context.clipboard[:parent].output_hash['id'].first
225
249
  logger.warn('MISSING ID WARNING') do
226
250
  [
227
- "A component in #{parent_id} did not have and ID so one was minted using the #{strategy} strategy.",
251
+ "A component in #{parent_id} did not have an ID so one was minted using the #{strategy} strategy.",
228
252
  "The ID of this document will be #{parent_id}#{hexdigest}."
229
253
  ].join(' ')
230
254
  end
255
+ record['id'] = hexdigest
256
+ hexdigest
231
257
  else
232
258
  record.attribute('id')&.value&.strip&.gsub('.', '-')
233
259
  end
@@ -247,13 +273,13 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
247
273
  accumulator << context.clipboard[:parent].output_hash['ead_ssi'].first
248
274
  end
249
275
 
250
- to_field 'title_filing_si', extract_xpath('./xmlns:did/xmlns:unittitle'), first_only
251
- to_field 'title_ssm', extract_xpath('./xmlns:did/xmlns:unittitle')
252
- to_field 'title_teim', extract_xpath('./xmlns:did/xmlns:unittitle')
276
+ to_field 'title_filing_si', extract_xpath('./did/unittitle'), first_only
277
+ to_field 'title_ssm', extract_xpath('./did/unittitle')
278
+ to_field 'title_teim', extract_xpath('./did/unittitle')
253
279
 
254
- to_field 'unitdate_bulk_ssim', extract_xpath('./xmlns:did/xmlns:unitdate[@type="bulk"]')
255
- to_field 'unitdate_inclusive_ssm', extract_xpath('./xmlns:did/xmlns:unitdate[@type="inclusive"]')
256
- to_field 'unitdate_other_ssim', extract_xpath('./xmlns:did/xmlns:unitdate[not(@type)]')
280
+ to_field 'unitdate_bulk_ssim', extract_xpath('./did/unitdate[@type="bulk"]')
281
+ to_field 'unitdate_inclusive_ssm', extract_xpath('./did/unitdate[@type="inclusive"]')
282
+ to_field 'unitdate_other_ssim', extract_xpath('./did/unitdate[not(@type)]')
257
283
 
258
284
  to_field 'normalized_title_ssm' do |_record, accumulator, context|
259
285
  dates = Arclight::NormalizedDate.new(
@@ -274,33 +300,50 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
274
300
  end
275
301
 
276
302
  to_field 'component_level_isim' do |record, accumulator|
277
- accumulator << 1 + record.ancestors.count { |node| node.name == 'c' }
303
+ accumulator << 1 + NokogiriXpathExtensions.new.is_component(record.ancestors).count
278
304
  end
279
305
 
280
- to_field 'parent_ssm' do |record, accumulator, context|
306
+ to_field 'parent_ssim' do |record, accumulator, context|
281
307
  accumulator << context.clipboard[:parent].output_hash['id'].first
282
- accumulator.concat NokogiriXpathExtensions.new.is_component(record.ancestors).reverse.map { |n| n.attribute('id').value }
308
+ accumulator.concat NokogiriXpathExtensions.new.is_component(record.ancestors).reverse.map { |n| n.attribute('id')&.value }
283
309
  end
284
310
 
285
311
  to_field 'parent_ssi' do |_record, accumulator, context|
286
- accumulator << context.output_hash['parent_ssm'].last
312
+ accumulator << context.output_hash['parent_ssim'].last
287
313
  end
288
314
 
289
- to_field 'parent_unittitles_ssm' do |_record, accumulator, context|
290
- ## Top level document
315
+ to_field 'parent_unittitles_ssm' do |_rec, accumulator, context|
316
+ # top level document
291
317
  accumulator.concat context.clipboard[:parent].output_hash['normalized_title_ssm']
292
- ## Other components
293
- context.output_hash['parent_ssm']&.drop(1)&.each do |id|
294
- accumulator.concat Array
295
- .wrap(context.clipboard[:parent].output_hash['components'])
296
- .find { |c| c['ref_ssi'] == [id] }&.[]('normalized_title_ssm')
318
+ parent_ssim = context.output_hash['parent_ssim']
319
+ components = context.clipboard[:parent].output_hash['components']
320
+
321
+ # other components
322
+ if parent_ssim && components
323
+ ancestors = parent_ssim.drop(1).map { |x| [x] }
324
+ accumulator.concat components.select { |c| ancestors.include? c['ref_ssi'] }.flat_map { |c| c['normalized_title_ssm'] }
297
325
  end
298
326
  end
327
+
299
328
  to_field 'parent_unittitles_teim' do |_record, accumulator, context|
300
329
  accumulator.concat context.output_hash['parent_unittitles_ssm']
301
330
  end
302
331
 
303
- to_field 'unitid_ssm', extract_xpath('./xmlns:did/xmlns:unitid')
332
+ to_field 'parent_levels_ssm' do |_record, accumulator, context|
333
+ ## Top level document
334
+ accumulator.concat context.clipboard[:parent].output_hash['level_ssm']
335
+ ## Other components
336
+ context.output_hash['parent_ssim']&.drop(1)&.each do |id|
337
+ accumulator.concat Array
338
+ .wrap(context.clipboard[:parent].output_hash['components'])
339
+ .select { |c| c['ref_ssi'] == [id] }.map { |c| c['level_ssm'] }.flatten
340
+ end
341
+ end
342
+
343
+ to_field 'unitid_ssm', extract_xpath('./did/unitid')
344
+ to_field 'collection_unitid_ssm' do |_record, accumulator, context|
345
+ accumulator.concat Array.wrap(context.clipboard[:parent].output_hash['unitid_ssm'])
346
+ end
304
347
  to_field 'repository_ssm' do |_record, accumulator, context|
305
348
  accumulator << context.clipboard[:parent].clipboard[:repository]
306
349
  end
@@ -313,22 +356,27 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
313
356
  to_field 'collection_sim' do |_record, accumulator, context|
314
357
  accumulator.concat context.clipboard[:parent].output_hash['normalized_title_ssm']
315
358
  end
359
+ to_field 'collection_ssi' do |_record, accumulator, context|
360
+ accumulator.concat context.clipboard[:parent].output_hash['normalized_title_ssm']
361
+ end
362
+
363
+ to_field 'extent_ssm', extract_xpath('./did/physdesc/extent')
364
+ to_field 'extent_teim', extract_xpath('./did/physdesc/extent')
316
365
 
317
- to_field 'extent_ssm', extract_xpath('./xmlns:did/xmlns:physdesc/xmlns:extent')
318
- to_field 'creator_ssm', extract_xpath("./xmlns:did/xmlns:origination[@label='creator']")
319
- to_field 'creator_ssim', extract_xpath("./xmlns:did/xmlns:origination[@label='creator']")
320
- to_field 'creators_ssim', extract_xpath("./xmlns:did/xmlns:origination[@label='creator']")
366
+ to_field 'creator_ssm', extract_xpath('./did/origination')
367
+ to_field 'creator_ssim', extract_xpath('./did/origination')
368
+ to_field 'creators_ssim', extract_xpath('./did/origination')
321
369
  to_field 'creator_sort' do |record, accumulator|
322
- accumulator << record.xpath("./xmlns:did/xmlns:origination[@label='creator']").map(&:text).join(', ')
370
+ accumulator << record.xpath('./did/origination').map(&:text).join(', ')
323
371
  end
324
372
  to_field 'collection_creator_ssm' do |_record, accumulator, context|
325
373
  accumulator.concat Array.wrap(context.clipboard[:parent].output_hash['creator_ssm'])
326
374
  end
327
- to_field 'has_online_content_ssim', extract_xpath('.//xmlns:dao') do |_record, accumulator|
375
+ to_field 'has_online_content_ssim', extract_xpath('.//dao') do |_record, accumulator|
328
376
  accumulator.replace([accumulator.any?])
329
377
  end
330
- to_field 'child_component_count_isim', extract_xpath('xmlns:c') do |_record, accumulator|
331
- accumulator.replace([accumulator.length])
378
+ to_field 'child_component_count_isim' do |record, accumulator|
379
+ accumulator << NokogiriXpathExtensions.new.is_component(record.children).count
332
380
  end
333
381
 
334
382
  to_field 'ref_ssm' do |record, accumulator|
@@ -338,13 +386,7 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
338
386
  to_field 'level_ssm' do |record, accumulator|
339
387
  level = record.attribute('level')&.value
340
388
  other_level = record.attribute('otherlevel')&.value
341
-
342
- accumulator << if level == 'otherlevel'
343
- alternative_level = other_level if other_level
344
- alternative_level.present? ? alternative_level : 'Other'
345
- elsif level.present?
346
- level&.capitalize
347
- end
389
+ accumulator << Arclight::LevelLabel.new(level, other_level).to_s
348
390
  end
349
391
 
350
392
  to_field 'level_sim' do |_record, accumulator, context|
@@ -353,52 +395,34 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
353
395
  accumulator.concat context.output_hash['level_ssm']&.map(&:capitalize)
354
396
  end
355
397
 
356
- to_field 'parent_access_restrict_ssm', extract_xpath('./xmlns:accessrestrict/xmlns:p')
357
-
358
- to_field 'parent_access_restrict_ssm' do |_record, accumulator, context|
359
- next unless context.output_hash['accessrestrict_ssm'].nil?
360
-
361
- context.output_hash['parent_ssm']&.each do |id|
362
- accumulator.concat Array
363
- .wrap(context.clipboard[:parent]&.output_hash&.[]('components'))
364
- .select { |c| c['ref_ssi'] == [id] }.map { |c| c['accessrestrict_ssm'] }
365
- end
366
- end
367
-
368
- to_field 'parent_access_restrict_ssm' do |_record, accumulator, context|
369
- next unless context.output_hash['parent_access_restrict_ssm'].nil?
370
-
371
- accumulator.concat Array.wrap(context.clipboard[:parent]&.output_hash&.[]('accessrestrict_ssm'))
398
+ to_field 'sort_ii' do |_record, accumulator, context|
399
+ accumulator.replace([context.position])
372
400
  end
373
401
 
374
- to_field 'parent_access_terms_ssm', extract_xpath('xmlns:userestrict/xmlns:p')
375
-
376
- to_field 'parent_access_terms_ssm' do |_record, accumulator, context|
377
- next unless context.output_hash['userestrict_ssm'].nil?
378
-
379
- context.output_hash['parent_ssm']&.each do |id|
380
- accumulator.concat Array
381
- .wrap(context.clipboard[:parent]&.output_hash&.[]('components'))
382
- .select { |c| c['ref_ssi'] == [id] }.map { |c| c['userestrict_ssm'] }
383
- end
402
+ # Get the <accessrestrict> from the closest ancestor that has one (includes top-level)
403
+ to_field 'parent_access_restrict_ssm' do |record, accumulator|
404
+ accumulator.concat Array
405
+ .wrap(record.xpath('(./ancestor::*/accessrestrict)[last()]/*[local-name()!="head"]')
406
+ .map(&:text))
384
407
  end
385
408
 
386
- to_field 'parent_access_terms_ssm' do |_record, accumulator, context|
387
- next unless context.output_hash['parent_access_terms_ssm'].nil?
388
-
389
- accumulator << context.clipboard[:parent]&.output_hash&.[]('access_terms_ssm')&.first
409
+ # Get the <userestrict> from self OR the closest ancestor that has one (includes top-level)
410
+ to_field 'parent_access_terms_ssm' do |record, accumulator|
411
+ accumulator.concat Array
412
+ .wrap(record.xpath('(./ancestor-or-self::*/userestrict)[last()]/*[local-name()!="head"]')
413
+ .map(&:text))
390
414
  end
391
415
 
392
- to_field 'digital_objects_ssm', extract_xpath('./xmlns:dao') do |record, accumulator|
393
- accumulator.concat(record.xpath('.//xmlns:dao', xmlns: 'urn:isbn:1-931666-22-9').map do |dao|
416
+ to_field 'digital_objects_ssm', extract_xpath('./dao|./did/dao', to_text: false) do |_record, accumulator|
417
+ accumulator.map! do |dao|
394
418
  label = dao.attributes['title']&.value ||
395
- dao.xpath('xmlns:daodesc/xmlns:p', xmlns: 'urn:isbn:1-931666-22-9')&.text
419
+ dao.xpath('daodesc/p')&.text
396
420
  href = (dao.attributes['href'] || dao.attributes['xlink:href'])&.value
397
421
  Arclight::DigitalObject.new(label: label, href: href).to_json
398
- end.to_a)
422
+ end
399
423
  end
400
424
 
401
- to_field 'date_range_sim', extract_xpath('.//xmlns:did/xmlns:unitdate/@normal', to_text: false) do |_record, accumulator|
425
+ to_field 'date_range_sim', extract_xpath('./did/unitdate/@normal', to_text: false) do |_record, accumulator|
402
426
  range = Arclight::YearRange.new
403
427
  next range.years if accumulator.blank?
404
428
 
@@ -408,19 +432,18 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
408
432
  end
409
433
 
410
434
  NAME_ELEMENTS.map do |selector|
411
- to_field 'names_ssim', extract_xpath("./xmlns:controlaccess/xmlns:#{selector}")
412
- to_field "#{selector}_ssm", extract_xpath(".//xmlns:#{selector}")
435
+ to_field 'names_ssim', extract_xpath("./controlaccess/#{selector}")
436
+ to_field "#{selector}_ssm", extract_xpath(".//#{selector}")
413
437
  end
414
438
 
415
- to_field 'geogname_sim', extract_xpath('./xmlns:controlaccess/xmlns:geogname')
416
- to_field 'geogname_ssm', extract_xpath('./xmlns:controlaccess/xmlns:geogname')
417
- to_field 'places_ssim', extract_xpath('xmlns:controlaccess/xmlns:geogname')
439
+ to_field 'geogname_sim', extract_xpath('./controlaccess/geogname')
440
+ to_field 'geogname_ssm', extract_xpath('./controlaccess/geogname')
441
+ to_field 'places_ssim', extract_xpath('./controlaccess/geogname')
418
442
 
419
- # Indexes only specified controlled terms for archival description into the access_subject field
420
- to_field 'access_subjects_ssim', extract_xpath('./xmlns:controlaccess', to_text: false) do |_record, accumulator|
443
+ to_field 'access_subjects_ssim', extract_xpath('./controlaccess', to_text: false) do |_record, accumulator|
421
444
  accumulator.map! do |element|
422
445
  %w[subject function occupation genreform].map do |selector|
423
- element.xpath(".//xmlns:#{selector}").map(&:text)
446
+ element.xpath(".//#{selector}").map(&:text)
424
447
  end
425
448
  end.flatten!
426
449
  end
@@ -429,31 +452,27 @@ compose 'components', ->(record, accumulator, _context) { accumulator.concat rec
429
452
  accumulator.concat(context.output_hash.fetch('access_subjects_ssim', []))
430
453
  end
431
454
 
432
- # Indexes the acquisition group information into the notes field
433
- # Please see https://www.loc.gov/ead/tglib/elements/acqinfo.html
434
- to_field 'acqinfo_ssim', extract_xpath('/xmlns:ead/xmlns:archdesc/xmlns:acqinfo/*[local-name()!="head"]')
435
- to_field 'acqinfo_ssim', extract_xpath('/xmlns:ead/xmlns:archdesc/xmlns:descgrp/xmlns:acqinfo/*[local-name()!="head"]')
436
- to_field 'acqinfo_ssim', extract_xpath('./xmlns:acqinfo/*[local-name()!="head"]')
437
- to_field 'acqinfo_ssim', extract_xpath('./xmlns:descgrp/xmlns:acqinfo/*[local-name()!="head"]')
438
- to_field 'acqinfo_ssm' do |_record, accumulator, context|
439
- accumulator.concat(context.output_hash.fetch('acqinfo_ssim', []))
440
- end
455
+ to_field 'acqinfo_ssim', extract_xpath('/ead/archdesc/acqinfo/*[local-name()!="head"]')
456
+ to_field 'acqinfo_ssim', extract_xpath('/ead/archdesc/descgrp/acqinfo/*[local-name()!="head"]')
457
+ to_field 'acqinfo_ssim', extract_xpath('./acqinfo/*[local-name()!="head"]')
458
+ to_field 'acqinfo_ssim', extract_xpath('./descgrp/acqinfo/*[local-name()!="head"]')
441
459
 
442
- to_field 'language_ssm', extract_xpath('./xmlns:did/xmlns:langmaterial')
460
+ to_field 'language_ssm', extract_xpath('./did/langmaterial')
443
461
  to_field 'containers_ssim' do |record, accumulator|
444
- record.xpath('./xmlns:did/xmlns:container').each do |node|
462
+ record.xpath('./did/container').each do |node|
445
463
  accumulator << [node.attribute('type'), node.text].join(' ').strip
446
464
  end
447
465
  end
466
+
448
467
  SEARCHABLE_NOTES_FIELDS.map do |selector|
449
- to_field "#{selector}_ssm", extract_xpath(".//xmlns:#{selector}/*[local-name()!='head']")
450
- to_field "#{selector}_heading_ssm", extract_xpath(".//xmlns:archdesc/xmlns:#{selector}/xmlns:head")
451
- to_field "#{selector}_teim", extract_xpath(".//xmlns:#{selector}/*[local-name()!='head']")
468
+ to_field "#{selector}_ssm", extract_xpath("./#{selector}/*[local-name()!='head']", to_text: false)
469
+ to_field "#{selector}_heading_ssm", extract_xpath("./#{selector}/head")
470
+ to_field "#{selector}_teim", extract_xpath("./#{selector}/*[local-name()!='head']")
452
471
  end
453
472
  DID_SEARCHABLE_NOTES_FIELDS.map do |selector|
454
- to_field "#{selector}_ssm", extract_xpath(".//xmlns:did/xmlns:#{selector}")
473
+ to_field "#{selector}_ssm", extract_xpath("./did/#{selector}", to_text: false)
455
474
  end
456
- to_field 'did_note_ssm', extract_xpath('.//xmlns:did/xmlns:note')
475
+ to_field 'did_note_ssm', extract_xpath('./did/note')
457
476
  end
458
477
 
459
478
  each_record do |_record, context|