From 64732597a02b47d5058797c7d4eebe5aeff40dfd Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Tue, 15 Aug 2023 16:11:42 -0700 Subject: [PATCH 1/2] find existing records more often, leading to better round tripping experiance --- app/factories/bulkrax/object_factory.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/factories/bulkrax/object_factory.rb b/app/factories/bulkrax/object_factory.rb index ed6e2e4c..d44c60fc 100644 --- a/app/factories/bulkrax/object_factory.rb +++ b/app/factories/bulkrax/object_factory.rb @@ -87,7 +87,8 @@ def update end def find - return find_by_id if attributes[:id].present? + found = find_by_id if attributes[:id].present? + return found if found.present? return search_by_identifier if attributes[work_identifier].present? end @@ -102,7 +103,8 @@ def find_or_create end def search_by_identifier - query = { work_identifier => + work_index = ::ActiveFedora.index_field_mapper.solr_name(work_identifier, :facetable) + query = { work_index => source_identifier_value } # Query can return partial matches (something6 matches both something6 and something68) # so we need to weed out any that are not the correct full match. But other items might be From db20c6ef7742e7465a21e12f8d8fdf3924772a78 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 24 Aug 2023 09:47:52 -0700 Subject: [PATCH 2/2] Update object_factory.rb --- app/factories/bulkrax/object_factory.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/factories/bulkrax/object_factory.rb b/app/factories/bulkrax/object_factory.rb index d44c60fc..df742308 100644 --- a/app/factories/bulkrax/object_factory.rb +++ b/app/factories/bulkrax/object_factory.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Bulkrax - class ObjectFactory + class ObjectFactory # rubocop:disable Metrics/ClassLength extend ActiveModel::Callbacks include Bulkrax::FileFactory include DynamicRecordLookup