From d63ecdac1a54bbf4d86a709d51a454f59fd80388 Mon Sep 17 00:00:00 2001 From: kethlinmil Date: Thu, 31 Oct 2024 15:19:07 +0100 Subject: [PATCH] fix: NOP-39 ARCE OAI: fix issue with duplicate "domainTopic" entries --- app/models/concerns/mods_arce_solr_document.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/mods_arce_solr_document.rb b/app/models/concerns/mods_arce_solr_document.rb index ad2742e45..e31d4a5ee 100644 --- a/app/models/concerns/mods_arce_solr_document.rb +++ b/app/models/concerns/mods_arce_solr_document.rb @@ -170,12 +170,15 @@ def to_mods_arce if topic_geographic.any? { |topic_geographic_key| self[topic_geographic_key].present? } xml['mods'].subject do self[:named_subject_tesim]&.each { |value| xml['mods'].name { xml['mods'].namePart value.to_s } } - filtered_topic_array = self[:subject_topic_tesim]&.reject { |item| self[:subject_cultural_object_tesim]&.include?(item) } + + mods_with_topic = [:subject_cultural_object_tesim, :subject_domain_topic_tesim].map { |name| self[name] || [] }.flatten + filtered_topic_array = self[:subject_topic_tesim]&.reject { |item| mods_with_topic.include?(item) } filtered_topic_array&.each { |value| xml['mods'].topic value.to_s } + self[:subject_temporal_tesim]&.each { |value| xml['mods'].temporal value.to_s } self[:subject_cultural_object_tesim]&.each { |value| xml['mods'].topic({ type: 'culturalObject' }, value.to_s) } self[:subject_domain_topic_tesim]&.each { |value| xml['mods'].topic({ type: 'domainTopic' }, value.to_s) } - self[:subject_geographic_tesim]&.each { |value| xml['mods']. geographic value.to_s } + self[:subject_geographic_tesim]&.each { |value| xml['mods'].geographic value.to_s } if self[:geographic_coordinates_ssim] # 95 xml['mods'].cartographics do #