bulkrax 5.5.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5935f574678e9ff331fb1c3e637512e81aaf133acd44ac6ba413828b663c3cf1
4
- data.tar.gz: d4a44f4fe47171d22c131bb836ec348091c88fcaa011a2e3a61b4234c8bb3be3
3
+ metadata.gz: 27625a6224b5a9a1f395e6e0ef8b7169fdfcf497b2fcd4268b760ed6d1c0444a
4
+ data.tar.gz: 2bdaba078e12824c62afb300ecf054d9299705b735acd552a86af3296e7e4599
5
5
  SHA512:
6
- metadata.gz: d14475603489ad27d29db6536e4e6d50e3d3393845724a7d85cf0c674804f3b42fbe1430ff9eea0d7e16d5f0482760ca1615e5a55b66a791ff5eab60f1950ea6
7
- data.tar.gz: e593a46744c543b2d9e140010178272b470427f726d3f91504b2e6969a15632f5cf467abe375f588b10b2b9821bcdc3b23730ecccb071b5e0411bbc4e794eb9c
6
+ metadata.gz: a5b037670580f6ae08a0a7cb810a4d11020d61baeeabe53aa17540767ae36385c72b0b3b1d953a73bd5a7a7bb7c979182db7b6c98f588fe362ae955b1a1c32ab
7
+ data.tar.gz: 7948683559e6ba2b5c1bc221ebcc6f5b10b674cf014baa1ff355baa7cfffc487148a701aa198572777c6a19457b13969156200ea02b8c74b79030a70bef6ddc9
@@ -241,7 +241,7 @@ module Bulkrax
241
241
  end
242
242
 
243
243
  def list_external_sets
244
- url = params[:base_url] || (@harvester ? @harvester.base_url : nil)
244
+ url = params[:base_url] || @harvester&.base_url
245
245
  setup_client(url) if url.present?
246
246
 
247
247
  @sets = [['All', 'all']]
@@ -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
- # TODO(alishaevn): return the proper `work_index` value below
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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '5.5.0'
4
+ VERSION = '6.0.0'
5
5
  end
@@ -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.all.each { |e| Bulkrax::ExporterJob.perform_later(e.id) }
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman