bulkrax 5.5.0 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/bulkrax/importers_controller.rb +1 -1
- data/app/factories/bulkrax/object_factory.rb +4 -8
- data/app/models/concerns/bulkrax/import_behavior.rb +1 -0
- data/app/parsers/bulkrax/application_parser.rb +9 -2
- data/lib/bulkrax/version.rb +1 -1
- data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +1 -1
- data/lib/tasks/bulkrax_tasks.rake +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9892c080d7d1cfa595d1965fae2e1b7372f6ec0b7042b0acc7ceb86a0421abd
|
4
|
+
data.tar.gz: bdd80bd311e47ad4705ed9d2770e24b10248656fa3f78c287943e829ed891c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0034564d49de171a95cc1b415b9593cb70080102eb4e66cf083eb1e8b2f04e7dce9fd80aef158008ddd17ee88a8e31afec468ce8a2b323d55399fbcabf3c2402
|
7
|
+
data.tar.gz: 861e1573df358bb3b610fde019c884c1f9ef944956aeabb7cd17c729c6b0ec281fb60036f29ccae3d98fe0aec5f46eed358a8ad87996b599c0c5f71e3366a491
|
@@ -28,15 +28,16 @@ module Bulkrax
|
|
28
28
|
class_attribute :transformation_removes_blank_hash_values, default: false
|
29
29
|
|
30
30
|
define_model_callbacks :save, :create
|
31
|
-
attr_reader :attributes, :object, :source_identifier_value, :klass, :replace_files, :update_files, :work_identifier, :related_parents_parsed_mapping, :importer_run_id
|
31
|
+
attr_reader :attributes, :object, :source_identifier_value, :klass, :replace_files, :update_files, :work_identifier, :work_identifier_search_field, :related_parents_parsed_mapping, :importer_run_id
|
32
32
|
|
33
33
|
# rubocop:disable Metrics/ParameterLists
|
34
|
-
def initialize(attributes:, source_identifier_value:, work_identifier:, related_parents_parsed_mapping: nil, replace_files: false, user: nil, klass: nil, importer_run_id: nil, update_files: false)
|
34
|
+
def initialize(attributes:, source_identifier_value:, work_identifier:, work_identifier_search_field:, related_parents_parsed_mapping: nil, replace_files: false, user: nil, klass: nil, importer_run_id: nil, update_files: false)
|
35
35
|
@attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
|
36
36
|
@replace_files = replace_files
|
37
37
|
@update_files = update_files
|
38
38
|
@user = user || User.batch_user
|
39
39
|
@work_identifier = work_identifier
|
40
|
+
@work_identifier_search_field = work_identifier_search_field
|
40
41
|
@related_parents_parsed_mapping = related_parents_parsed_mapping
|
41
42
|
@source_identifier_value = source_identifier_value
|
42
43
|
@klass = klass || Bulkrax.default_work_type.constantize
|
@@ -103,12 +104,7 @@ module Bulkrax
|
|
103
104
|
end
|
104
105
|
|
105
106
|
def search_by_identifier
|
106
|
-
|
107
|
-
# ref: https://github.com/samvera-labs/bulkrax/issues/866
|
108
|
-
# ref:https://github.com/samvera-labs/bulkrax/issues/867
|
109
|
-
# work_index = ::ActiveFedora.index_field_mapper.solr_name(work_identifier, :facetable)
|
110
|
-
work_index = work_identifier
|
111
|
-
query = { work_index =>
|
107
|
+
query = { work_identifier_search_field =>
|
112
108
|
source_identifier_value }
|
113
109
|
# Query can return partial matches (something6 matches both something6 and something68)
|
114
110
|
# so we need to weed out any that are not the correct full match. But other items might be
|
@@ -179,6 +179,7 @@ module Bulkrax
|
|
179
179
|
@factory ||= of.new(attributes: self.parsed_metadata,
|
180
180
|
source_identifier_value: identifier,
|
181
181
|
work_identifier: parser.work_identifier,
|
182
|
+
work_identifier_search_field: parser.work_identifier_search_field,
|
182
183
|
related_parents_parsed_mapping: parser.related_parents_parsed_mapping,
|
183
184
|
replace_files: replace_files,
|
184
185
|
user: user,
|
@@ -81,6 +81,13 @@ module Bulkrax
|
|
81
81
|
@work_identifier ||= get_field_mapping_hash_for('source_identifier')&.keys&.first&.to_sym || :source
|
82
82
|
end
|
83
83
|
|
84
|
+
# @return [Symbol] the solr property of the source_identifier. Used for searching.
|
85
|
+
# defaults to work_identifier value + "_sim"
|
86
|
+
# @see #work_identifier
|
87
|
+
def work_identifier_search_field
|
88
|
+
@work_identifier_search_field ||= Array.wrap(get_field_mapping_hash_for('source_identifier')&.values&.first&.[]('search_field'))&.first&.to_s || "#{work_identifier}_sim"
|
89
|
+
end
|
90
|
+
|
84
91
|
# @return [String]
|
85
92
|
def generated_metadata_mapping
|
86
93
|
@generated_metadata_mapping ||= 'generated'
|
@@ -95,7 +102,7 @@ module Bulkrax
|
|
95
102
|
# @return [String]
|
96
103
|
# @see #related_parents_field_mapping
|
97
104
|
def related_parents_parsed_mapping
|
98
|
-
@related_parents_parsed_mapping ||=
|
105
|
+
@related_parents_parsed_mapping ||= get_field_mapping_hash_for('related_parents_field_mapping')&.keys&.first || 'parents'
|
99
106
|
end
|
100
107
|
|
101
108
|
# @return [String, NilClass]
|
@@ -107,7 +114,7 @@ module Bulkrax
|
|
107
114
|
# @return [String]
|
108
115
|
# @see #related_children_raw_mapping
|
109
116
|
def related_children_parsed_mapping
|
110
|
-
@related_children_parsed_mapping ||=
|
117
|
+
@related_children_parsed_mapping ||= get_field_mapping_hash_for('related_children_field_mapping')&.keys&.first || 'children'
|
111
118
|
end
|
112
119
|
|
113
120
|
# @api private
|
data/lib/bulkrax/version.rb
CHANGED
@@ -47,7 +47,7 @@ Bulkrax.setup do |config|
|
|
47
47
|
# (For more info on importing relationships, see Bulkrax Wiki: https://github.com/samvera-labs/bulkrax/wiki/Configuring-Bulkrax#parent-child-relationship-field-mappings)
|
48
48
|
#
|
49
49
|
# # e.g. to add the required source_identifier field
|
50
|
-
# # config.field_mappings["Bulkrax::CsvParser"]["source_id"] = { from: ["old_source_id"], source_identifier: true
|
50
|
+
# # config.field_mappings["Bulkrax::CsvParser"]["source_id"] = { from: ["old_source_id"], source_identifier: true, search_field: 'source_id_sim' }
|
51
51
|
# If you want Bulkrax to fill in source_identifiers for you, see below
|
52
52
|
|
53
53
|
# To duplicate a set of mappings from one parser to another
|
@@ -124,7 +124,7 @@ namespace :bulkrax do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def make_new_exports
|
127
|
-
Bulkrax::Exporter.
|
127
|
+
Bulkrax::Exporter.find_each { |e| Bulkrax::ExporterJob.perform_later(e.id) }
|
128
128
|
rescue => e
|
129
129
|
puts "(#{e.message})"
|
130
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulkrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Kaufman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|