diff --git a/lib/arclight/traject/ead2_component_config.rb b/lib/arclight/traject/ead2_component_config.rb index 598422f4c..ed0f4a9ac 100644 --- a/lib/arclight/traject/ead2_component_config.rb +++ b/lib/arclight/traject/ead2_component_config.rb @@ -167,12 +167,25 @@ accumulator.concat settings[:root].output_hash['normalized_title_ssm'] end +# This accumulates direct text from a physdesc, ignoring child elements handled elsewhere +to_field 'physdesc_tesim', extract_xpath('./did/physdesc', to_text: false) do |_record, accumulator| + accumulator.map! do |element| + physdesc = [] + element.children.map do |child| + next if child.instance_of?(Nokogiri::XML::Element) + + physdesc << child.text&.strip unless child.text&.strip&.empty? + end.flatten + physdesc.join(' ') unless physdesc.empty? + end +end + to_field 'extent_ssm' do |record, accumulator| physdescs = record.xpath('./did/physdesc') extents_per_physdesc = physdescs.map do |physdesc| extents = physdesc.xpath('./extent').map { |e| e.text.strip } # Join extents within the same physdesc with an empty string - extents.join(' ') + extents.join(' ') unless extents.empty? end # Add each physdesc separately to the accumulator @@ -183,6 +196,9 @@ accumulator.concat context.output_hash['extent_ssm'] || [] end +to_field 'physfacet_tesim', extract_xpath('./did/physdesc/physfacet') +to_field 'dimensions_tesim', extract_xpath('./did/physdesc/dimensions') + to_field 'creator_ssm', extract_xpath('./did/origination') to_field 'creator_ssim', extract_xpath('./did/origination') to_field 'creators_ssim', extract_xpath('./did/origination') diff --git a/lib/arclight/traject/ead2_config.rb b/lib/arclight/traject/ead2_config.rb index b2371f9bf..0fcb55128 100644 --- a/lib/arclight/traject/ead2_config.rb +++ b/lib/arclight/traject/ead2_config.rb @@ -183,12 +183,25 @@ end end +# This accumulates direct text from a physdesc, ignoring child elements handled elsewhere +to_field 'physdesc_tesim', extract_xpath('/ead/archdesc/did/physdesc', to_text: false) do |_record, accumulator| + accumulator.map! do |element| + physdesc = [] + element.children.map do |child| + next if child.instance_of?(Nokogiri::XML::Element) + + physdesc << child.text&.strip unless child.text&.strip&.empty? + end.flatten + physdesc.join(' ') unless physdesc.empty? + end +end + to_field 'extent_ssm' do |record, accumulator| physdescs = record.xpath('/ead/archdesc/did/physdesc') extents_per_physdesc = physdescs.map do |physdesc| extents = physdesc.xpath('./extent').map { |e| e.text.strip } # Join extents within the same physdesc with an empty string - extents.join(' ') + extents.join(' ') unless extents.empty? end # Add each physdesc separately to the accumulator @@ -199,6 +212,9 @@ accumulator.concat context.output_hash['extent_ssm'] || [] end +to_field 'physfacet_tesim', extract_xpath('/ead/archdesc/did/physdesc/physfacet') +to_field 'dimensions_tesim', extract_xpath('/ead/archdesc/did/physdesc/dimensions') + to_field 'genreform_ssim', extract_xpath('/ead/archdesc/controlaccess/genreform') to_field 'date_range_isim', extract_xpath('/ead/archdesc/did/unitdate/@normal', to_text: false) do |_record, accumulator| diff --git a/lib/generators/arclight/templates/catalog_controller.rb b/lib/generators/arclight/templates/catalog_controller.rb index 64976c6e0..c088b4aca 100644 --- a/lib/generators/arclight/templates/catalog_controller.rb +++ b/lib/generators/arclight/templates/catalog_controller.rb @@ -279,6 +279,9 @@ class CatalogController < ApplicationController config.add_background_field 'accruals', field: 'accruals_html_tesm', helper_method: :render_html_tags config.add_background_field 'phystech', field: 'phystech_html_tesm', helper_method: :render_html_tags config.add_background_field 'physloc', field: 'physloc_html_tesm', helper_method: :render_html_tags + config.add_background_field 'physdesc', field: 'physdesc_tesim', helper_method: :render_html_tags + config.add_background_field 'physfacet', field: 'physfacet_tesim', helper_method: :render_html_tags + config.add_background_field 'dimensions', field: 'dimensions_tesim', helper_method: :render_html_tags 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 @@ -335,6 +338,9 @@ class CatalogController < ApplicationController config.add_component_field 'phystech', field: 'phystech_html_tesm', helper_method: :render_html_tags config.add_component_field 'materialspec', field: 'materialspec_tesim', helper_method: :render_html_tags config.add_component_field 'physloc', field: 'physloc_html_tesm', helper_method: :render_html_tags + config.add_component_field 'physdesc', field: 'physdesc_tesim', helper_method: :render_html_tags + config.add_component_field 'physfacet', field: 'physfacet_tesim', helper_method: :render_html_tags + config.add_component_field 'dimensions', field: 'dimensions_tesim', helper_method: :render_html_tags config.add_component_field 'fileplan', field: 'fileplan_html_tesim', helper_method: :render_html_tags config.add_component_field 'altformavail', field: 'altformavail_html_tesim', helper_method: :render_html_tags config.add_component_field 'otherfindaid', field: 'otherfindaid_html_tesm', helper_method: :render_html_tags diff --git a/lib/generators/arclight/templates/config/locales/arclight.en.yml b/lib/generators/arclight/templates/config/locales/arclight.en.yml index 71266d078..5b6327bab 100644 --- a/lib/generators/arclight/templates/config/locales/arclight.en.yml +++ b/lib/generators/arclight/templates/config/locales/arclight.en.yml @@ -18,6 +18,9 @@ en: accruals: Accruals phystech: Physical / technical requirements physloc: Physical location + physdesc: Physical description + physfacet: Physical facet + dimensions: Dimensions descrules: Rules or conventions relatedmaterial: Related material diff --git a/spec/features/collection_page_spec.rb b/spec/features/collection_page_spec.rb index 96d060e1f..c26c7c649 100644 --- a/spec/features/collection_page_spec.rb +++ b/spec/features/collection_page_spec.rb @@ -73,7 +73,7 @@ end end - it 'background has configured metadata' do + it 'background has configured metadata' do # rubocop:disable RSpec/MultipleExpectations within '#background' do expect(page).to have_css('dt', text: 'Scope and content') expect(page).to have_css('dd', text: /^Correspondence, documents, records, photos/) @@ -99,6 +99,15 @@ expect(page).to have_css('dt', text: 'Arrangement') expect(page).to have_css('dd', text: /^Arranged into seven series\./) + expect(page).to have_css('dt', text: 'Physical description') + expect(page).to have_css('dd', text: /^Boxes and folders/) + + expect(page).to have_css('dt', text: 'Physical facet') + expect(page).to have_css('dd', text: /^Compact digital disc/) + + expect(page).to have_css('dt', text: 'Dimensions') + expect(page).to have_css('dd', text: /^7\.5 x 5\.5 in\./) + 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/) end diff --git a/spec/features/component_page_spec.rb b/spec/features/component_page_spec.rb index fddeb49f3..0e6ce8fce 100644 --- a/spec/features/component_page_spec.rb +++ b/spec/features/component_page_spec.rb @@ -83,6 +83,17 @@ expect(page).to have_css('dd', text: /^These papers were maintained by the staff/) end + it 'shows configured component fields' do + expect(page).to have_css('dt', text: 'Extent') + expect(page).to have_css('dd', text: /^2 Linear Feet/) + expect(page).to have_css('dt', text: 'Physical description') + expect(page).to have_css('dd', text: /^Mixed Materials/) + expect(page).to have_css('dt', text: 'Dimensions') + expect(page).to have_css('dd', text: /^various/) + expect(page).to have_css('dt', text: 'Physical facet') + expect(page).to have_css('dd', text: /^Boxes and folders/) + end + it 'multivalued notes are rendered as paragaphs' do within 'dd.blacklight-appraisal' do expect(page).to have_css('p', count: 2) diff --git a/spec/features/traject/ead2_indexing_spec.rb b/spec/features/traject/ead2_indexing_spec.rb index 212acfbf4..2cfb7eaad 100644 --- a/spec/features/traject/ead2_indexing_spec.rb +++ b/spec/features/traject/ead2_indexing_spec.rb @@ -120,8 +120,22 @@ def components(result) expect(result['places_ssim']).to equal_array_ignoring_whitespace ['Yosemite National Park (Calif.)'] end - it 'physdesc' do - expect(result['extent_ssm']).to equal_array_ignoring_whitespace ['1.25 Linear Feet (1 volume)', '1 document case', '16 DVDRs'] + describe 'physdesc' do + it 'direct text' do + expect(result['physdesc_tesim']).to equal_array_ignoring_whitespace ['Photographic album', 'Single bound volume'] + end + + it 'extent' do + expect(result['extent_tesim']).to equal_array_ignoring_whitespace ['1.25 Linear Feet (1 volume)', '1 document case', '16 DVDRs'] + end + + it 'physfacet' do + expect(result['physfacet_tesim']).to equal_array_ignoring_whitespace ['Printed material', 'Digital Video Disc'] + end + + it 'dimensions' do + expect(result['dimensions_tesim']).to equal_array_ignoring_whitespace ['20 x 20 in.', '7.5 x 5.5 in.'] + end end it 'has_online_content' do @@ -295,18 +309,49 @@ def components(result) ).to_a.first end - it 'extent at the collection level' do - %w[extent_ssm extent_tesim].each do |field| - expect(result[field]).to equal_array_ignoring_whitespace(['15.0 linear feet (36 boxes + oversize folder)', '3 CDs']) + describe 'physdesc at the collection level' do + it 'direct text' do + expect(result['physdesc_tesim']).to equal_array_ignoring_whitespace ['Boxes and folders', 'Compact discs'] + end + + it 'extent' do + %w[extent_ssm extent_tesim].each do |field| + expect(result[field]).to equal_array_ignoring_whitespace(['15.0 linear feet (36 boxes + oversize folder)', '3 CDs']) + end + end + + it 'physfacet' do + expect(result['physfacet_tesim']).to equal_array_ignoring_whitespace ['Compact digital disc'] + end + + it 'dimensions' do + expect(result['dimensions_tesim']).to equal_array_ignoring_whitespace ['7.5 x 5.5 in.'] end end - it 'extent at the component level' do - component = all_components.find { |c| c['ref_ssi'] == ['aspace_a951375d104030369a993ff943f61a77'] } - %w[extent_ssm extent_tesim].each do |field| - expect(component[field]).to equal_array_ignoring_whitespace( - ['1.5 Linear Feet'] - ) + describe 'physdesc at the component level' do + let(:component) do + all_components.find { |c| c['ref_ssi'] == ['aspace_a951375d104030369a993ff943f61a77'] } + end + + it 'direct text' do + expect(component['physdesc_tesim']).to equal_array_ignoring_whitespace ['Cards and sheets of various sizes'] + end + + it 'extent' do + %w[extent_ssm extent_tesim].each do |field| + expect(component[field]).to equal_array_ignoring_whitespace( + ['1.5 Linear Feet'] + ) + end + end + + it 'physfacet' do + expect(component['physfacet_tesim']).to equal_array_ignoring_whitespace ['Informational cards'] + end + + it 'dimensions' do + expect(component['dimensions_tesim']).to equal_array_ignoring_whitespace ['various'] end end diff --git a/spec/fixtures/ead/nlm/alphaomegaalpha.xml b/spec/fixtures/ead/nlm/alphaomegaalpha.xml index 7f9b5fb25..6e8c60d72 100644 --- a/spec/fixtures/ead/nlm/alphaomegaalpha.xml +++ b/spec/fixtures/ead/nlm/alphaomegaalpha.xml @@ -41,11 +41,19 @@ Alpha Omega Alpha MS C 271 + + Boxes and folders + + + Compact discs + 15.0 linear feet (36 boxes + oversize folder) + 7.5 x 5.5 in. + Compact digital disc 3 CDs 1894-1992 @@ -393,7 +401,7 @@ Historical Note

- The Society started keeping consistent adminstrative records in 1975, the same year that E. L. Doctorow published Ragtime. + The Society started keeping consistent adminstrative records in 1975, the same year that E. L. Doctorow published Ragtime.

@@ -466,6 +474,16 @@ Constitution and by-laws - drafts, 1902-1904 + + Mixed Materials + + + Boxes and folders + + + various + 2 Linear Feet + 1 Series II: Membership, MS C 271.II - 1.5 Linear - Feet + + Cards and sheets of various sizes + + + Informational cards + + + various + 1.5 Linear Feet + 1902-1973 Contains a mixture of membership cards and membership rosters. diff --git a/spec/fixtures/ead/sul-spec/a0011.xml b/spec/fixtures/ead/sul-spec/a0011.xml index 8563271fa..5f7b778f0 100644 --- a/spec/fixtures/ead/sul-spec/a0011.xml +++ b/spec/fixtures/ead/sul-spec/a0011.xml @@ -78,13 +78,23 @@ A0011 + Photographic album + + + Single bound volume + + + Printed material 1.25 Linear Feet (1 volume) + 20 x 20 in. 1 document case + 7.5 x 5.5 in. + Digital Video Disc 16 DVDRs circa 1900-1906