bulkrax 5.5.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +7 -0
- 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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27625a6224b5a9a1f395e6e0ef8b7169fdfcf497b2fcd4268b760ed6d1c0444a
|
4
|
+
data.tar.gz: 2bdaba078e12824c62afb300ecf054d9299705b735acd552a86af3296e7e4599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b037670580f6ae08a0a7cb810a4d11020d61baeeabe53aa17540767ae36385c72b0b3b1d953a73bd5a7a7bb7c979182db7b6c98f588fe362ae955b1a1c32ab
|
7
|
+
data.tar.gz: 7948683559e6ba2b5c1bc221ebcc6f5b10b674cf014baa1ff355baa7cfffc487148a701aa198572777c6a19457b13969156200ea02b8c74b79030a70bef6ddc9
|
@@ -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 ||= 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'
|
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
|