Skip to content

Commit

Permalink
Removing ssm versions of physdesc fields since tesim is both stored a…
Browse files Browse the repository at this point in the history
…nd indexed.
  • Loading branch information
randalldfloyd committed Dec 13, 2023
1 parent 20331c1 commit 6249895
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
9 changes: 1 addition & 8 deletions lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
end

# This accumulates direct text from a physdesc, ignoring child elements handled elsewhere
to_field 'physdesc_ssm', extract_xpath('./did/physdesc', to_text: false) do |_record, accumulator|
to_field 'physdesc_tesim', extract_xpath('./did/physdesc', to_text: false) do |_record, accumulator|
accumulator.map! do |element|
physdesc = []
element.children.map do |child|
Expand All @@ -168,10 +168,6 @@
end
end

to_field 'physdesc_tesim' do |_record, accumulator, context|
accumulator.concat context.output_hash['physdesc_ssm'] || []
end

to_field 'extent_ssm' do |record, accumulator|
physdescs = record.xpath('./did/physdesc')
extents_per_physdesc = physdescs.map do |physdesc|
Expand All @@ -188,10 +184,7 @@
accumulator.concat context.output_hash['extent_ssm'] || []
end

to_field 'physfacet_ssm', extract_xpath('./did/physdesc/physfacet')
to_field 'physfacet_tesim', extract_xpath('./did/physdesc/physfacet')

to_field 'dimensions_ssm', extract_xpath('./did/physdesc/dimensions')
to_field 'dimensions_tesim', extract_xpath('./did/physdesc/dimensions')

to_field 'creator_ssm', extract_xpath('./did/origination')
Expand Down
9 changes: 1 addition & 8 deletions lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
end

# This accumulates direct text from a physdesc, ignoring child elements handled elsewhere
to_field 'physdesc_ssm', extract_xpath('/ead/archdesc/did/physdesc', to_text: false) do |_record, accumulator|
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|
Expand All @@ -196,10 +196,6 @@
end
end

to_field 'physdesc_tesim' do |_record, accumulator, context|
accumulator.concat context.output_hash['physdesc_ssm'] || []
end

to_field 'extent_ssm' do |record, accumulator|
physdescs = record.xpath('/ead/archdesc/did/physdesc')
extents_per_physdesc = physdescs.map do |physdesc|
Expand All @@ -216,10 +212,7 @@
accumulator.concat context.output_hash['extent_ssm'] || []
end

to_field 'physfacet_ssm', extract_xpath('/ead/archdesc/did/physdesc/physfacet')
to_field 'physfacet_tesim', extract_xpath('/ead/archdesc/did/physdesc/physfacet')

to_field 'dimensions_ssm', extract_xpath('/ead/archdesc/did/physdesc/dimensions')
to_field 'dimensions_tesim', extract_xpath('/ead/archdesc/did/physdesc/dimensions')

to_field 'genreform_ssim', extract_xpath('/ead/archdesc/controlaccess/genreform')
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/arclight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ 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 'physfacet', field: 'physfacet_ssm', helper_method: :render_html_tags
config.add_background_field 'dimensions', field: 'dimensions_ssm', 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
Expand Down
20 changes: 10 additions & 10 deletions spec/features/traject/ead2_indexing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,19 @@ def components(result)

describe 'physdesc' do
it 'direct text' do
expect(result['physdesc_ssm']).to equal_array_ignoring_whitespace ['Photographic album', 'Single bound volume']
expect(result['physdesc_tesim']).to equal_array_ignoring_whitespace ['Photographic album', 'Single bound volume']
end

it 'extent' do
expect(result['extent_ssm']).to equal_array_ignoring_whitespace ['1.25 Linear Feet (1 volume)', '1 document case', '16 DVDRs']
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_ssm']).to equal_array_ignoring_whitespace ['Printed material', 'Digital Video Disc']
expect(result['physfacet_tesim']).to equal_array_ignoring_whitespace ['Printed material', 'Digital Video Disc']
end

it 'dimensions' do
expect(result['dimensions_ssm']).to equal_array_ignoring_whitespace ['20 x 20 in.', '7.5 x 5.5 in.']
expect(result['dimensions_tesim']).to equal_array_ignoring_whitespace ['20 x 20 in.', '7.5 x 5.5 in.']
end
end

Expand Down Expand Up @@ -311,7 +311,7 @@ def components(result)

describe 'physdesc at the collection level' do
it 'direct text' do
expect(result['physdesc_ssm']).to equal_array_ignoring_whitespace ['Boxes and folders', 'Compact discs']
expect(result['physdesc_tesim']).to equal_array_ignoring_whitespace ['Boxes and folders', 'Compact discs']
end

it 'extent' do
Expand All @@ -321,11 +321,11 @@ def components(result)
end

it 'physfacet' do
expect(result['physfacet_ssm']).to equal_array_ignoring_whitespace ['Compact digital disc']
expect(result['physfacet_tesim']).to equal_array_ignoring_whitespace ['Compact digital disc']
end

it 'dimensions' do
expect(result['dimensions_ssm']).to equal_array_ignoring_whitespace ['7.5 x 5.5 in.']
expect(result['dimensions_tesim']).to equal_array_ignoring_whitespace ['7.5 x 5.5 in.']
end
end

Expand All @@ -335,7 +335,7 @@ def components(result)
end

it 'direct text' do
expect(component['physdesc_ssm']).to equal_array_ignoring_whitespace ['Cards and sheets of various sizes']
expect(component['physdesc_tesim']).to equal_array_ignoring_whitespace ['Cards and sheets of various sizes']
end

it 'extent' do
Expand All @@ -347,11 +347,11 @@ def components(result)
end

it 'physfacet' do
expect(component['physfacet_ssm']).to equal_array_ignoring_whitespace ['Informational cards']
expect(component['physfacet_tesim']).to equal_array_ignoring_whitespace ['Informational cards']
end

it 'dimensions' do
expect(component['dimensions_ssm']).to equal_array_ignoring_whitespace ['various']
expect(component['dimensions_tesim']).to equal_array_ignoring_whitespace ['various']
end
end

Expand Down

0 comments on commit 6249895

Please sign in to comment.