diff --git a/lib/arclight/traject/ead2_component_config.rb b/lib/arclight/traject/ead2_component_config.rb index ac846827f..4183ae144 100644 --- a/lib/arclight/traject/ead2_component_config.rb +++ b/lib/arclight/traject/ead2_component_config.rb @@ -300,6 +300,13 @@ end end +# Skip over elaborate bibliography text and only index list of child bibref elements +to_field 'bibref_tesm', extract_xpath('.//bibliography//bibref') do |_record, accumulator| + accumulator.map! do |b| + b&.strip + end.flatten! +end + SEARCHABLE_NOTES_FIELDS.map do |selector| to_field "#{selector}_html_tesm", extract_xpath("./#{selector}/*[local-name()!='head']", to_text: false) to_field "#{selector}_heading_ssm", extract_xpath("./#{selector}/head") diff --git a/lib/arclight/traject/ead2_config.rb b/lib/arclight/traject/ead2_config.rb index 328c390fe..5c5f82922 100644 --- a/lib/arclight/traject/ead2_config.rb +++ b/lib/arclight/traject/ead2_config.rb @@ -229,6 +229,14 @@ to_field 'indexes_html_tesm', extract_xpath('/ead/archdesc/index', to_text: false) to_field 'indexes_tesim', extract_xpath('/ead/archdesc/index') +# Skip over elaborate bibliography text and only index list of child bibref elements. +# The bibref elements can be in many places for collection level; ignore if in subordinate components. +to_field 'bibref_tesm', extract_xpath('/ead//bibliography//bibref[not(ancestor::dsc)]') do |_record, accumulator| + accumulator.map! do |b| + b&.strip + end.flatten! +end + SEARCHABLE_NOTES_FIELDS.map do |selector| to_field "#{selector}_html_tesm", extract_xpath("/ead/archdesc/#{selector}/*[local-name()!='head']", to_text: false) do |_record, accumulator| accumulator.map!(&:to_html) diff --git a/lib/generators/arclight/templates/catalog_controller.rb b/lib/generators/arclight/templates/catalog_controller.rb index 7b6aba897..91fe7d81e 100644 --- a/lib/generators/arclight/templates/catalog_controller.rb +++ b/lib/generators/arclight/templates/catalog_controller.rb @@ -299,6 +299,7 @@ class CatalogController < ApplicationController config.add_background_field 'materialspec', field: 'materialspec_tesim', helper_method: :render_html_tags config.add_background_field 'fileplan', field: 'fileplan_html_tesim', helper_method: :render_html_tags config.add_background_field 'descrules', field: 'descrules_ssm', helper_method: :render_html_tags + config.add_background_field 'bibref', field: 'bibref_tesm', helper_method: :render_html_tags # Collection Show Page - Related Section config.add_related_field 'relatedmaterial', field: 'relatedmaterial_html_tesm', helper_method: :render_html_tags @@ -365,7 +366,8 @@ class CatalogController < ApplicationController config.add_component_field 'relatedmaterial', field: 'relatedmaterial_html_tesm', helper_method: :render_html_tags config.add_component_field 'separatedmaterial', field: 'separatedmaterial_html_tesm', helper_method: :render_html_tags config.add_component_field 'originalsloc', field: 'originalsloc_html_tesm', helper_method: :render_html_tags - + config.add_component_field 'bibref', field: 'bibref_tesm', helper_method: :render_html_tags + # Component Show Page - Indexed Terms Section config.add_component_indexed_terms_field 'access_subjects', field: 'access_subjects_ssim', link_to_facet: true, separator_options: { words_connector: '
', diff --git a/lib/generators/arclight/templates/config/locales/arclight.en.yml b/lib/generators/arclight/templates/config/locales/arclight.en.yml index 55a84154d..3d2b1569e 100644 --- a/lib/generators/arclight/templates/config/locales/arclight.en.yml +++ b/lib/generators/arclight/templates/config/locales/arclight.en.yml @@ -23,6 +23,7 @@ en: dimensions: Dimensions indexes: Indexes descrules: Rules or conventions + bibref: Bibliography relatedmaterial: Related material separatedmaterial: Separated material diff --git a/spec/features/collection_page_spec.rb b/spec/features/collection_page_spec.rb index 523fdf42f..6832b8965 100644 --- a/spec/features/collection_page_spec.rb +++ b/spec/features/collection_page_spec.rb @@ -110,6 +110,9 @@ expect(page).to have_css('dt', text: 'Rules or conventions') expect(page).to have_css('dd', text: /^Finding aid prepared using Rules for Archival Description/) + + expect(page).to have_css('dt', text: 'Bibliography') + expect(page).to have_css('dd', text: /^Medical society annual. 2008/) end end diff --git a/spec/features/component_page_spec.rb b/spec/features/component_page_spec.rb index 5a6326f0e..8ea6f2a0b 100644 --- a/spec/features/component_page_spec.rb +++ b/spec/features/component_page_spec.rb @@ -94,6 +94,8 @@ expect(page).to have_css('dd', text: /^Boxes and folders/) expect(page).to have_css('dt', text: 'Scope and content') expect(page).to have_css('table thead tr th', text: 'GHI') + expect(page).to have_css('dt', text: 'Bibliography') + expect(page).to have_css('dd', text: /^Student regulations. 2008/) end it 'multivalued notes are rendered as paragaphs' do diff --git a/spec/features/traject/ead2_indexing_spec.rb b/spec/features/traject/ead2_indexing_spec.rb index 2cfb7eaad..b41bfa563 100644 --- a/spec/features/traject/ead2_indexing_spec.rb +++ b/spec/features/traject/ead2_indexing_spec.rb @@ -138,6 +138,13 @@ def components(result) end end + describe 'bibliography' do + # We skip bibliography text so only test for list of child bibref elements + it 'bibref' do + expect(result['bibref_tesm']).to equal_array_ignoring_whitespace ['Student life annual. 2008', 'Student life annual. 2009'] + end + end + it 'has_online_content' do expect(result['has_online_content_ssim']).to eq [true] end @@ -568,6 +575,18 @@ def components(result) end end + describe 'bibliography' do + let(:fixture_path) do + Arclight::Engine.root.join('spec', 'fixtures', 'ead', 'nlm', 'alphaomegaalpha.xml') + end + + # We skip bibliography text so only test for list of child bibref elements + it 'bibref' do + component = all_components.find { |c| c['ref_ssi'] == ['aspace_dc2aaf83625280ae2e193beb3f4aea78'] } + expect(component['bibref_tesm']).to equal_array_ignoring_whitespace ['Student regulations. 2008', 'Student regulations. 2009'] + end + end + describe 'geognames' do let(:fixture_path) do Arclight::Engine.root.join('spec', 'fixtures', 'ead', 'nlm', 'alphaomegaalpha.xml') diff --git a/spec/fixtures/ead/nlm/alphaomegaalpha.xml b/spec/fixtures/ead/nlm/alphaomegaalpha.xml index 93fa5343f..c6752e509 100644 --- a/spec/fixtures/ead/nlm/alphaomegaalpha.xml +++ b/spec/fixtures/ead/nlm/alphaomegaalpha.xml @@ -29,6 +29,15 @@ + + Selected Bibliography + + Medical society annual.2008 + + + Medical society annual.2009 + + English @@ -487,6 +496,15 @@ + + Selected Bibliography + + Student regulations.2008 + + + Student regulations.2009 + + Constitution and by-laws - drafts, 1902-1904 diff --git a/spec/fixtures/ead/sul-spec/a0011.xml b/spec/fixtures/ead/sul-spec/a0011.xml index 5f7b778f0..055f293c8 100644 --- a/spec/fixtures/ead/sul-spec/a0011.xml +++ b/spec/fixtures/ead/sul-spec/a0011.xml @@ -60,6 +60,15 @@ + + Selected Bibliography + + Student life annual.2008 + + + Student life annual.2009 + + English @@ -162,6 +171,12 @@ + + Selected Bibliography + + Student life annual.2010 + + Photograph Album