Skip to content

Commit f214f77

Browse files
committed
Adding bibliography/bibref elements to indexers and catalog views
1 parent 9142012 commit f214f77

File tree

9 files changed

+76
-1
lines changed

9 files changed

+76
-1
lines changed

lib/arclight/traject/ead2_component_config.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@
300300
end
301301
end
302302

303+
# Skip over elaborate bibliography text and only index list of child bibref elements
304+
to_field 'bibref_tesm', extract_xpath('.//bibliography//bibref') do |_record, accumulator|
305+
accumulator.map! do |b|
306+
b&.strip
307+
end.flatten!
308+
end
309+
303310
SEARCHABLE_NOTES_FIELDS.map do |selector|
304311
to_field "#{selector}_html_tesm", extract_xpath("./#{selector}/*[local-name()!='head']", to_text: false)
305312
to_field "#{selector}_heading_ssm", extract_xpath("./#{selector}/head")

lib/arclight/traject/ead2_config.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@
229229
to_field 'indexes_html_tesm', extract_xpath('/ead/archdesc/index', to_text: false)
230230
to_field 'indexes_tesim', extract_xpath('/ead/archdesc/index')
231231

232+
# Skip over elaborate bibliography text and only index list of child bibref elements.
233+
# The bibref elements can be in many places for collection level; ignore if in subordinate components.
234+
to_field 'bibref_tesm', extract_xpath('/ead//bibliography//bibref[not(ancestor::dsc)]') do |_record, accumulator|
235+
accumulator.map! do |b|
236+
b&.strip
237+
end.flatten!
238+
end
239+
232240
SEARCHABLE_NOTES_FIELDS.map do |selector|
233241
to_field "#{selector}_html_tesm", extract_xpath("/ead/archdesc/#{selector}/*[local-name()!='head']", to_text: false) do |_record, accumulator|
234242
accumulator.map!(&:to_html)

lib/generators/arclight/templates/catalog_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class CatalogController < ApplicationController
299299
config.add_background_field 'materialspec', field: 'materialspec_tesim', helper_method: :render_html_tags
300300
config.add_background_field 'fileplan', field: 'fileplan_html_tesim', helper_method: :render_html_tags
301301
config.add_background_field 'descrules', field: 'descrules_ssm', helper_method: :render_html_tags
302+
config.add_background_field 'bibref', field: 'bibref_tesm', helper_method: :render_html_tags
302303

303304
# Collection Show Page - Related Section
304305
config.add_related_field 'relatedmaterial', field: 'relatedmaterial_html_tesm', helper_method: :render_html_tags
@@ -365,7 +366,8 @@ class CatalogController < ApplicationController
365366
config.add_component_field 'relatedmaterial', field: 'relatedmaterial_html_tesm', helper_method: :render_html_tags
366367
config.add_component_field 'separatedmaterial', field: 'separatedmaterial_html_tesm', helper_method: :render_html_tags
367368
config.add_component_field 'originalsloc', field: 'originalsloc_html_tesm', helper_method: :render_html_tags
368-
369+
config.add_component_field 'bibref', field: 'bibref_tesm', helper_method: :render_html_tags
370+
369371
# Component Show Page - Indexed Terms Section
370372
config.add_component_indexed_terms_field 'access_subjects', field: 'access_subjects_ssim', link_to_facet: true, separator_options: {
371373
words_connector: '<br/>',

lib/generators/arclight/templates/config/locales/arclight.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ en:
2323
dimensions: Dimensions
2424
indexes: Indexes
2525
descrules: Rules or conventions
26+
bibref: Bibliography
2627

2728
relatedmaterial: Related material
2829
separatedmaterial: Separated material

spec/features/collection_page_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110

111111
expect(page).to have_css('dt', text: 'Rules or conventions')
112112
expect(page).to have_css('dd', text: /^Finding aid prepared using Rules for Archival Description/)
113+
114+
expect(page).to have_css('dt', text: 'Bibliography')
115+
expect(page).to have_css('dd', text: /^Medical society annual. 2008/)
113116
end
114117
end
115118

spec/features/component_page_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
expect(page).to have_css('dd', text: /^Boxes and folders/)
9595
expect(page).to have_css('dt', text: 'Scope and content')
9696
expect(page).to have_css('table thead tr th', text: 'GHI')
97+
expect(page).to have_css('dt', text: 'Bibliography')
98+
expect(page).to have_css('dd', text: /^Campus regulations. 2008/)
9799
end
98100

99101
it 'multivalued notes are rendered as paragaphs' do

spec/features/traject/ead2_indexing_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ def components(result)
138138
end
139139
end
140140

141+
describe 'bibliography' do
142+
# We skip bibliography text so only test for list of child bibref elements
143+
it 'bibref' do
144+
expect(result['bibref_tesm']).to equal_array_ignoring_whitespace ['Campus annual. 2008', 'Campus annual. 2009']
145+
end
146+
end
147+
141148
it 'has_online_content' do
142149
expect(result['has_online_content_ssim']).to eq [true]
143150
end
@@ -568,6 +575,18 @@ def components(result)
568575
end
569576
end
570577

578+
describe 'bibliography' do
579+
let(:fixture_path) do
580+
Arclight::Engine.root.join('spec', 'fixtures', 'ead', 'nlm', 'alphaomegaalpha.xml')
581+
end
582+
583+
# We skip bibliography text so only test for list of child bibref elements
584+
it 'bibref' do
585+
component = all_components.find { |c| c['ref_ssi'] == ['aspace_dc2aaf83625280ae2e193beb3f4aea78'] }
586+
expect(component['bibref_tesm']).to equal_array_ignoring_whitespace ['Campus regulations. 2008', 'Campus regulations. 2009']
587+
end
588+
end
589+
571590
describe 'geognames' do
572591
let(:fixture_path) do
573592
Arclight::Engine.root.join('spec', 'fixtures', 'ead', 'nlm', 'alphaomegaalpha.xml')

spec/fixtures/ead/nlm/alphaomegaalpha.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
</profiledesc>
3030
</eadheader>
3131
<archdesc level="collection">
32+
<bibliography>
33+
<head>Selected Bibliography</head>
34+
<bibref>
35+
<title render="italic">Medical society annual.</title>2008
36+
</bibref>
37+
<bibref>
38+
<title render="italic">Medical society annual.</title>2009
39+
</bibref>
40+
</bibliography>
3241
<did>
3342
<langmaterial>
3443
<language langcode="eng">English</language>
@@ -487,6 +496,15 @@
487496
</did>
488497
</c>
489498
<c id="aspace_dc2aaf83625280ae2e193beb3f4aea78" level="otherlevel">
499+
<bibliography>
500+
<head>Selected Bibliography</head>
501+
<bibref>
502+
<title render="italic">Campus regulations.</title>2008
503+
</bibref>
504+
<bibref>
505+
<title render="italic">Campus regulations.</title>2009
506+
</bibref>
507+
</bibliography>
490508
<did>
491509
<unittitle>Constitution and by-laws - drafts,</unittitle>
492510
<unitdate normal="1902/1904" type="inclusive">1902-1904</unitdate>

spec/fixtures/ead/sul-spec/a0011.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@
6060
</profiledesc>
6161
</eadheader>
6262
<archdesc audience="internal" level="collection">
63+
<bibliography>
64+
<head>Selected Bibliography</head>
65+
<bibref>
66+
<title render="italic">Campus annual.</title>2008
67+
</bibref>
68+
<bibref>
69+
<title render="italic">Campus annual.</title>2009
70+
</bibref>
71+
</bibliography>
6372
<did>
6473
<langmaterial>
6574
<language langcode="eng">English</language>
@@ -162,6 +171,12 @@
162171
</controlaccess>
163172
<dsc>
164173
<c01 id="aspace_ref6_lx4" level="file">
174+
<bibliography>
175+
<head>Selected Bibliography</head>
176+
<bibref>
177+
<title render="italic">Campus annual.</title>2010
178+
</bibref>
179+
</bibliography>
165180
<did>
166181
<unittitle>Photograph Album</unittitle>
167182
<dao audience="internal" xlink:actuate="onRequest"

0 commit comments

Comments
 (0)