Skip to content
Open
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
13 changes: 11 additions & 2 deletions lib/um_arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
originalsloc
otherfindaid
phystech
relatedmaterial
scopecontent
separatedmaterial
].freeze

DID_SEARCHABLE_NOTES_FIELDS = %w[
Expand All @@ -53,6 +51,8 @@
accruals
prefercite
processinfo
relatedmaterial
separatedmaterial
userestrict
].freeze

Expand Down Expand Up @@ -266,6 +266,15 @@
to_field "#{selector}_tesim", extract_xpath("/ead/archdesc/descgrp[@type != 'add']/#{selector}/*[local-name()!='head']")
end

# UM modified queries to match actual EADs, which have relatedmaterial/separatedmaterial in descgrp[@type='add']
%w[relatedmaterial separatedmaterial].each do |selector|
to_field "#{selector}_html_tesm", extract_xpath("/ead/archdesc/descgrp[@type='add']/#{selector}/*[local-name()!='head']", to_text: false) do |_record, accumulator|
accumulator.map!(&:to_html)
end
to_field "#{selector}_heading_ssm", extract_xpath("/ead/archdesc/descgrp[@type='add']/#{selector}/head")
to_field "#{selector}_tesim", extract_xpath("/ead/archdesc/descgrp[@type='add']/#{selector}/*[local-name()!='head']")
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we only want to do the to_field calls once for relatedmaterial and separatedmaterial, but you're including them in DESCGRP_FIELDS as well, so they'd be called twice. I think we can remove these two keys from DESCGRP_FIELDS but I may be missing something.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. The keys are already defined near the top of the file. I will remove line 270: %w[relatedmaterial separatedmaterial].each do |selector|.

Note: I was keeping the old chunk using [@type != 'add'] in case our EAD patterns change or differ in some edge cases.


DID_SEARCHABLE_NOTES_FIELDS.map do |selector|
to_field "#{selector}_html_tesm", extract_xpath("/ead/archdesc/did/#{selector}", to_text: false)
to_field "#{selector}_tesim", extract_xpath("/ead/archdesc/did/#{selector}")
Expand Down
Loading