From b36c517c3f23e504fd171d867f87b7d58f2c0913 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Mon, 11 Dec 2023 10:14:40 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Bulkrax=20undefined=20fiel?= =?UTF-8?q?d=20b=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bulkrax/application_parser_decorator.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/parsers/bulkrax/application_parser_decorator.rb diff --git a/app/parsers/bulkrax/application_parser_decorator.rb b/app/parsers/bulkrax/application_parser_decorator.rb new file mode 100644 index 00000000..dbb5bf49 --- /dev/null +++ b/app/parsers/bulkrax/application_parser_decorator.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Bulkrax + module ApplicationParserDecorator + def work_identifier_search_field + @work_identifier_search_field ||= Array.wrap(get_field_mapping_hash_for('source_identifier') + &.values + &.first + &.[]('search_field'))&.first&.to_s || "#{work_identifier}_sim" + end + end +end + +Bulkrax::ApplicationParser.prepend(Bulkrax::ApplicationParserDecorator)