kithe 2.2.0 → 2.3.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: df697bf6cd0128be5ee217fb3eb191af55994b1284e1e05f75da73667e92d8f3
4
- data.tar.gz: f388992232e60a99f7a6f7a2743e47a1690152665b9c85adbdf34457ce822104
3
+ metadata.gz: 5f1252c0becbda9f754e23af2333aaae66cf40cbfd6bacdad0f97425cd317de6
4
+ data.tar.gz: 8460f704869d27d5a2011f746e88b9016fde465d1cbb023c883fe600b0510c1d
5
5
  SHA512:
6
- metadata.gz: '079a440ca120cc56e4a624b335cab990b2dc0f8a7df73821f251ecae4bf17f91000e9f57bc59c01d6a378577c871d1bc5d8a31ccee3a49a8402459edb532c7c0'
7
- data.tar.gz: 73ba63882d5df383011c354c648b82f422891018679c8397a13143a937f9f9a12142eac18ea22d3162bb0f3f127b7ba9234a7309a18bd6329013c598ad17737d
6
+ metadata.gz: '0890b072c3bfb9901f4c910fcaf0f288dd72dc8c8164202998dfabf2db4b3f7a09dfeaa8df6c4c9cd242b0c98ec084c48f5214d4a2c8f4991ee6d08643495857'
7
+ data.tar.gz: e7c2bbe6f3f32ce67c646289f038a06d51f371fdb87634657296546c84fe3cb52a216b0a3c6648669f73e7d61f51b56a3afb0d28584fc85950dbf0936d6f5eda
@@ -57,7 +57,7 @@ module Kithe
57
57
  def initialize(batching:, disable_callbacks:, original_settings:,
58
58
  writer:, on_finish:)
59
59
  @original_settings = original_settings
60
- @batching = !!batching
60
+ @batching = batching
61
61
  @disable_callbacks = disable_callbacks
62
62
  @on_finish = on_finish
63
63
 
@@ -80,8 +80,9 @@ module Kithe
80
80
  def writer
81
81
  @writer ||= begin
82
82
  if @batching
83
+ batch_size = (@batching == true) ? Kithe.indexable_settings.batching_mode_batch_size : @batching
83
84
  @local_writer = true
84
- Kithe.indexable_settings.writer_instance!("solr_writer.batch_size" => 100)
85
+ Kithe.indexable_settings.writer_instance!("solr_writer.batch_size" => batch_size)
85
86
  end
86
87
  end
87
88
  end
@@ -1,5 +1,8 @@
1
1
  class Kithe::Validators::ModelParent < ActiveModel::Validator
2
2
  def validate(record)
3
+ # don't load the parent just to validate it if it hasn't even changed.
4
+ return unless record.parent_id_changed?
5
+
3
6
  if record.parent.present? && (record.parent.class <= Kithe::Asset)
4
7
  record.errors.add(:parent, 'can not be an Asset instance')
5
8
  end
@@ -7,7 +10,5 @@ class Kithe::Validators::ModelParent < ActiveModel::Validator
7
10
  if record.parent.present? && record.class <= Kithe::Collection
8
11
  record.errors.add(:parent, 'is invalid for Collection instances')
9
12
  end
10
-
11
- # TODO avoid recursive parents, maybe using a postgres CTE for efficiency?
12
13
  end
13
14
  end
@@ -1,14 +1,17 @@
1
1
  module Kithe
2
2
  class IndexableSettings
3
3
  attr_accessor :solr_url, :writer_class_name, :writer_settings,
4
- :model_name_solr_field, :solr_id_value_attribute, :disable_callbacks
4
+ :model_name_solr_field, :solr_id_value_attribute, :disable_callbacks,
5
+ :batching_mode_batch_size
5
6
  def initialize(solr_url:, writer_class_name:, writer_settings:,
6
- model_name_solr_field:, solr_id_value_attribute:, disable_callbacks: false)
7
+ model_name_solr_field:, solr_id_value_attribute:, disable_callbacks: false,
8
+ batching_mode_batch_size: 100)
7
9
  @solr_url = solr_url
8
10
  @writer_class_name = writer_class_name
9
11
  @writer_settings = writer_settings
10
12
  @model_name_solr_field = model_name_solr_field
11
13
  @solr_id_value_attribute = solr_id_value_attribute || 'id'
14
+ @batching_mode_batch_size = batching_mode_batch_size
12
15
  end
13
16
 
14
17
  # Use configured solr_url, and merge together with configured
data/lib/kithe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kithe
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kithe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -264,6 +264,20 @@ dependencies:
264
264
  - - ">="
265
265
  - !ruby/object:Gem::Version
266
266
  version: '0'
267
+ - !ruby/object:Gem::Dependency
268
+ name: db-query-matchers
269
+ requirement: !ruby/object:Gem::Requirement
270
+ requirements:
271
+ - - "<"
272
+ - !ruby/object:Gem::Version
273
+ version: '1'
274
+ type: :development
275
+ prerelease: false
276
+ version_requirements: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - "<"
279
+ - !ruby/object:Gem::Version
280
+ version: '1'
267
281
  - !ruby/object:Gem::Dependency
268
282
  name: pg
269
283
  requirement: !ruby/object:Gem::Requirement