Skip to content

Commit

Permalink
Adding bibliography/bibref elements to indexers and catalog views
Browse files Browse the repository at this point in the history
  • Loading branch information
randalldfloyd committed Dec 18, 2023
1 parent 9142012 commit f250c71
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 8 additions & 0 deletions lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion lib/generators/arclight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: '<br/>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ en:
dimensions: Dimensions
indexes: Indexes
descrules: Rules or conventions
bibref: Bibliography

relatedmaterial: Related material
separatedmaterial: Separated material
Expand Down
3 changes: 3 additions & 0 deletions spec/features/collection_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions spec/features/component_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions spec/features/traject/ead2_indexing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
18 changes: 18 additions & 0 deletions spec/fixtures/ead/nlm/alphaomegaalpha.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
</profiledesc>
</eadheader>
<archdesc level="collection">
<bibliography>
<head>Selected Bibliography</head>
<bibref>
<title render="italic">Medical society annual.</title>2008
</bibref>
<bibref>
<title render="italic">Medical society annual.</title>2009
</bibref>
</bibliography>
<did>
<langmaterial>
<language langcode="eng">English</language>
Expand Down Expand Up @@ -487,6 +496,15 @@
</did>
</c>
<c id="aspace_dc2aaf83625280ae2e193beb3f4aea78" level="otherlevel">
<bibliography>
<head>Selected Bibliography</head>
<bibref>
<title render="italic">Student regulations.</title>2008
</bibref>
<bibref>
<title render="italic">Student regulations.</title>2009
</bibref>
</bibliography>
<did>
<unittitle>Constitution and by-laws - drafts,</unittitle>
<unitdate normal="1902/1904" type="inclusive">1902-1904</unitdate>
Expand Down
15 changes: 15 additions & 0 deletions spec/fixtures/ead/sul-spec/a0011.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
</profiledesc>
</eadheader>
<archdesc audience="internal" level="collection">
<bibliography>
<head>Selected Bibliography</head>
<bibref>
<title render="italic">Student life annual.</title>2008
</bibref>
<bibref>
<title render="italic">Student life annual.</title>2009
</bibref>
</bibliography>
<did>
<langmaterial>
<language langcode="eng">English</language>
Expand Down Expand Up @@ -162,6 +171,12 @@
</controlaccess>
<dsc>
<c01 id="aspace_ref6_lx4" level="file">
<bibliography>
<head>Selected Bibliography</head>
<bibref>
<title render="italic">Student life annual.</title>2010
</bibref>
</bibliography>
<did>
<unittitle>Photograph Album</unittitle>
<dao audience="internal" xlink:actuate="onRequest"
Expand Down

0 comments on commit f250c71

Please sign in to comment.