Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding bibliography/bibref elements to indexers and catalog views #1505

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
end
end

# Skip over elaborate bibliography text and only index list of child bibref elements
to_field 'bibref_html_tesm', extract_xpath('.//bibliography//bibref', to_text: false)

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
4 changes: 4 additions & 0 deletions lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@
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_html_tesm', extract_xpath('/ead//bibliography//bibref[not(ancestor::dsc)]', to_text: false)

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
2 changes: 2 additions & 0 deletions lib/generators/arclight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class CatalogController < ApplicationController
config.add_background_field 'fileplan', field: 'fileplan_html_tesm', helper_method: :render_html_tags
config.add_background_field 'descrules', field: 'descrules_ssm', helper_method: :render_html_tags
config.add_background_field 'note', field: 'note_html_tesm', helper_method: :render_html_tags
config.add_background_field 'bibref', field: 'bibref_html_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 @@ -369,6 +370,7 @@ class CatalogController < ApplicationController
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 'note', field: 'note_html_tesm', helper_method: :render_html_tags
config.add_component_field 'bibref', field: 'bibref_html_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: {
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 @@ -96,6 +96,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: /^Campus 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_html_tesm'].first).to match(/Campus annual/)
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_html_tesm'].first).to match(/Campus regulations/)
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">Campus regulations</title>. 2008
</bibref>
<bibref>
<title render="italic">Campus 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">Campus annual</title>. 2008
</bibref>
<bibref>
<title render="italic">Campus annual</title>. 2009
</bibref>
</bibliography>
<did>
<langmaterial>
<language langcode="eng">English</language>
Expand Down Expand Up @@ -165,6 +174,12 @@
</controlaccess>
<dsc>
<c01 id="aspace_ref6_lx4" level="file">
<bibliography>
<head>Selected Bibliography</head>
<bibref>
<title render="italic">Campus annual.</title>2010
</bibref>
</bibliography>
<did>
<unittitle>Photograph Album</unittitle>
<dao audience="internal" xlink:actuate="onRequest"
Expand Down