algoliasearch-rails 2.2.1 → 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: 6433c4f68c91187b97118401b684386ba5cdf5be16e37aaa45e650805bf7af8e
4
- data.tar.gz: 81f4035a44f66d65e98f37630a683fef8b152a6c605f6a50974c8a37d9b518e5
3
+ metadata.gz: 91a3c57ba564afcd15833841c0c4dad105b1889179281b43e59a1adcb5c3acd2
4
+ data.tar.gz: d8bdac6cdf53cb6f095e1d485c6ceff1d94a17c6d649d76cefd29dca37d65172
5
5
  SHA512:
6
- metadata.gz: fa288fd052a2ff08ba427128c42e313563bf8e6c54cb7e4347c1e526e981806c4cd8d77bf91865fac3c9d2d84b1591ee628cbbd1d0e043b1a3b1b45d3f6e227a
7
- data.tar.gz: 2baff463707d56ab0937b3887eeb61b2833d2ee79e06a550211e32a14adb364a6129a89d61384cfa5b788cba8086f297d1fcdecdde7bdba75978286a35f2491f
6
+ metadata.gz: 13fe3ebce7b706de4324f0ee1f5fea8fdcfb6913445cc56a24a337868ac9f98edd173b5559a58921b73156d1dfe5d56fd3bd302666923966e5a1c4328369b5ec
7
+ data.tar.gz: f6237c40c513bacdb78ebd307668c0ae478c4e20f600a5d9ac10ca164ab2082e9515d9061177e5b93faf9ffebafbe4c864f80851c9466ac23565f4a7dadc83b4
data/CHANGELOG.MD CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...master)
4
4
 
5
+ ## [2.2.2](https://github.com/algolia/algoliasearch-rails/compare/2.2.2...2.3.0)
6
+ ### Fixed
7
+ * bugfix: don't consider objectID changed when using custom ID through method [`#436`](https://github.com/algolia/algoliasearch-rails/pull/436)
8
+
9
+ ## [2.2.2](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...2.2.2)
10
+ ### Fixed
11
+ * fix: wrong method name [`#429`](https://github.com/algolia/algoliasearch-rails/pull/429)
12
+ * fix: check if `Sequel::Model` is defined [`#433`](https://github.com/algolia/algoliasearch-rails/pull/433)
13
+
5
14
  ## [2.2.1](https://github.com/algolia/algoliasearch-rails/compare/2.2.0...2.2.1)
6
15
  ### Fixed
7
16
  * fix:settings changes detection issue with empty array [`#424`](https://github.com/algolia/algoliasearch-rails/pull/424)
data/Gemfile.lock CHANGED
@@ -65,74 +65,71 @@ GEM
65
65
  minitest (>= 5.1)
66
66
  tzinfo (~> 2.0)
67
67
  zeitwerk (~> 2.3)
68
- algolia (2.2.2)
69
- faraday (>= 0.15, < 2.0)
68
+ algolia (2.3.2)
69
+ faraday (>= 0.15, < 3)
70
+ faraday-net_http_persistent (>= 0.15, < 3)
70
71
  multi_json (~> 1.0)
71
72
  net-http-persistent
72
73
  builder (3.2.4)
73
74
  case_transform (0.2)
74
75
  activesupport
75
- concurrent-ruby (1.1.10)
76
- connection_pool (2.2.5)
76
+ concurrent-ruby (1.2.2)
77
+ connection_pool (2.4.1)
77
78
  crass (1.0.6)
79
+ date (3.3.3)
78
80
  diff-lcs (1.5.0)
79
- erubi (1.10.0)
80
- faraday (1.10.0)
81
- faraday-em_http (~> 1.0)
82
- faraday-em_synchrony (~> 1.0)
83
- faraday-excon (~> 1.1)
84
- faraday-httpclient (~> 1.0)
85
- faraday-multipart (~> 1.0)
86
- faraday-net_http (~> 1.0)
87
- faraday-net_http_persistent (~> 1.0)
88
- faraday-patron (~> 1.0)
89
- faraday-rack (~> 1.0)
90
- faraday-retry (~> 1.0)
81
+ erubi (1.12.0)
82
+ faraday (2.7.10)
83
+ faraday-net_http (>= 2.0, < 3.1)
91
84
  ruby2_keywords (>= 0.0.4)
92
- faraday-em_http (1.0.0)
93
- faraday-em_synchrony (1.0.0)
94
- faraday-excon (1.1.0)
95
- faraday-httpclient (1.0.1)
96
- faraday-multipart (1.0.3)
97
- multipart-post (>= 1.2, < 3)
98
- faraday-net_http (1.0.1)
99
- faraday-net_http_persistent (1.2.0)
100
- faraday-patron (1.0.0)
101
- faraday-rack (1.0.0)
102
- faraday-retry (1.0.3)
103
- globalid (1.0.0)
85
+ faraday-net_http (3.0.2)
86
+ faraday-net_http_persistent (2.1.0)
87
+ faraday (~> 2.5)
88
+ net-http-persistent (~> 4.0)
89
+ globalid (1.1.0)
104
90
  activesupport (>= 5.0)
105
- i18n (1.10.0)
91
+ i18n (1.14.1)
106
92
  concurrent-ruby (~> 1.0)
107
- json (2.6.1)
93
+ json (2.6.3)
108
94
  jsonapi-renderer (0.2.2)
109
95
  kaminari (0.17.0)
110
96
  actionpack (>= 3.0.0)
111
97
  activesupport (>= 3.0.0)
112
- loofah (2.16.0)
98
+ loofah (2.21.3)
113
99
  crass (~> 1.0.2)
114
- nokogiri (>= 1.5.9)
115
- mail (2.7.1)
100
+ nokogiri (>= 1.12.0)
101
+ mail (2.8.1)
116
102
  mini_mime (>= 0.1.1)
103
+ net-imap
104
+ net-pop
105
+ net-smtp
117
106
  marcel (1.0.2)
118
107
  method_source (1.0.0)
119
- mini_mime (1.1.2)
120
- mini_portile2 (2.8.0)
121
- minitest (5.15.0)
108
+ mini_mime (1.1.5)
109
+ mini_portile2 (2.8.4)
110
+ minitest (5.19.0)
122
111
  multi_json (1.15.0)
123
- multipart-post (2.1.1)
124
- net-http-persistent (4.0.1)
112
+ net-http-persistent (4.0.2)
125
113
  connection_pool (~> 2.2)
126
- nio4r (2.5.8)
127
- nokogiri (1.13.4)
114
+ net-imap (0.3.7)
115
+ date
116
+ net-protocol
117
+ net-pop (0.1.2)
118
+ net-protocol
119
+ net-protocol (0.2.1)
120
+ timeout
121
+ net-smtp (0.3.3)
122
+ net-protocol
123
+ nio4r (2.5.9)
124
+ nokogiri (1.13.10)
128
125
  mini_portile2 (~> 2.8.0)
129
126
  racc (~> 1.4)
130
- psych (4.0.3)
127
+ psych (5.1.0)
131
128
  stringio
132
- racc (1.6.0)
133
- rack (2.2.3)
134
- rack-test (1.1.0)
135
- rack (>= 1.0, < 3)
129
+ racc (1.7.1)
130
+ rack (2.2.8)
131
+ rack-test (2.1.0)
132
+ rack (>= 1.3)
136
133
  rails (6.1.4.7)
137
134
  actioncable (= 6.1.4.7)
138
135
  actionmailbox (= 6.1.4.7)
@@ -148,11 +145,12 @@ GEM
148
145
  bundler (>= 1.15.0)
149
146
  railties (= 6.1.4.7)
150
147
  sprockets-rails (>= 2.0.0)
151
- rails-dom-testing (2.0.3)
152
- activesupport (>= 4.2.0)
148
+ rails-dom-testing (2.2.0)
149
+ activesupport (>= 5.0.0)
150
+ minitest
153
151
  nokogiri (>= 1.6)
154
- rails-html-sanitizer (1.4.2)
155
- loofah (~> 2.3)
152
+ rails-html-sanitizer (1.5.0)
153
+ loofah (~> 2.19, >= 2.19.1)
156
154
  railties (6.1.4.7)
157
155
  actionpack (= 6.1.4.7)
158
156
  activesupport (= 6.1.4.7)
@@ -160,7 +158,7 @@ GEM
160
158
  rake (>= 0.13)
161
159
  thor (~> 1.0)
162
160
  rake (10.1.1)
163
- rdoc (6.4.0)
161
+ rdoc (6.5.0)
164
162
  psych (>= 4.0.0)
165
163
  redgreen (1.2.2)
166
164
  rspec (2.99.0)
@@ -172,24 +170,25 @@ GEM
172
170
  diff-lcs (>= 1.1.3, < 2.0)
173
171
  rspec-mocks (2.99.4)
174
172
  ruby2_keywords (0.0.5)
175
- sequel (5.55.0)
176
- sprockets (4.0.3)
173
+ sequel (5.71.0)
174
+ sprockets (4.2.0)
177
175
  concurrent-ruby (~> 1.0)
178
- rack (> 1, < 3)
176
+ rack (>= 2.2.4, < 4)
179
177
  sprockets-rails (3.4.2)
180
178
  actionpack (>= 5.2)
181
179
  activesupport (>= 5.2)
182
180
  sprockets (>= 3.0.0)
183
- sqlite3 (1.4.2)
184
- stringio (3.0.1)
185
- thor (1.2.1)
186
- tzinfo (2.0.4)
181
+ sqlite3 (1.4.4)
182
+ stringio (3.0.6)
183
+ thor (1.2.2)
184
+ timeout (0.4.0)
185
+ tzinfo (2.0.6)
187
186
  concurrent-ruby (~> 1.0)
188
- websocket-driver (0.7.5)
187
+ websocket-driver (0.7.6)
189
188
  websocket-extensions (>= 0.1.0)
190
189
  websocket-extensions (0.1.5)
191
- will_paginate (3.3.1)
192
- zeitwerk (2.5.4)
190
+ will_paginate (4.0.0)
191
+ zeitwerk (2.6.11)
193
192
 
194
193
  PLATFORMS
195
194
  ruby
@@ -212,4 +211,4 @@ DEPENDENCIES
212
211
  will_paginate (>= 2.3.15)
213
212
 
214
213
  BUNDLED WITH
215
- 1.17.2
214
+ 2.1.4
@@ -1,6 +1,6 @@
1
1
  module AlgoliaSearch
2
2
  module Configuration
3
- def initiliaze
3
+ def initialize
4
4
  @client = nil
5
5
  end
6
6
 
@@ -1,3 +1,3 @@
1
1
  module AlgoliaSearch
2
- VERSION = '2.2.1'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -123,7 +123,7 @@ module AlgoliaSearch
123
123
  end
124
124
 
125
125
  def is_sequel?(object)
126
- defined?(::Sequel) && object.class < ::Sequel::Model
126
+ defined?(::Sequel) && defined?(::Sequel::Model) && object.class < ::Sequel::Model
127
127
  end
128
128
 
129
129
  def is_active_record?(object)
@@ -382,7 +382,7 @@ module AlgoliaSearch
382
382
  attr_accessor :highlight_result, :snippet_result
383
383
 
384
384
  if options[:synchronous] == true
385
- if defined?(::Sequel) && self < Sequel::Model
385
+ if defined?(::Sequel) && defined?(::Sequel::Model) && self < Sequel::Model
386
386
  class_eval do
387
387
  copy_after_validation = instance_method(:after_validation)
388
388
  define_method(:after_validation) do |*args|
@@ -413,7 +413,7 @@ module AlgoliaSearch
413
413
  end
414
414
  end
415
415
  unless options[:auto_index] == false
416
- if defined?(::Sequel) && self < Sequel::Model
416
+ if defined?(::Sequel) && defined?(::Sequel::Model) && self < Sequel::Model
417
417
  class_eval do
418
418
  copy_after_validation = instance_method(:after_validation)
419
419
  copy_before_save = instance_method(:before_save)
@@ -460,7 +460,7 @@ module AlgoliaSearch
460
460
  end
461
461
  end
462
462
  unless options[:auto_remove] == false
463
- if defined?(::Sequel) && self < Sequel::Model
463
+ if defined?(::Sequel) && defined?(::Sequel::Model) && self < Sequel::Model
464
464
  class_eval do
465
465
  copy_after_destroy = instance_method(:after_destroy)
466
466
 
@@ -753,14 +753,13 @@ module AlgoliaSearch
753
753
  next if options[:replica]
754
754
  return true if algolia_object_id_changed?(object, options)
755
755
  settings.get_attribute_names(object).each do |k|
756
- return true if algolia_attribute_changed?(object, k)
757
- # return true if !object.respond_to?(changed_method) || object.send(changed_method)
756
+ return true if algolia_attribute_changed?(object, k, true)
758
757
  end
759
758
  [options[:if], options[:unless]].each do |condition|
760
759
  case condition
761
760
  when nil
762
761
  when String, Symbol
763
- return true if algolia_attribute_changed?(object, condition)
762
+ return true if algolia_attribute_changed?(object, condition, true)
764
763
  else
765
764
  # if the :if, :unless condition is a anything else,
766
765
  # we have no idea whether we should reindex or not
@@ -837,7 +836,7 @@ module AlgoliaSearch
837
836
  end
838
837
 
839
838
  def algolia_object_id_changed?(o, options = nil)
840
- changed = algolia_attribute_changed?(o, algolia_object_id_method(options))
839
+ changed = algolia_attribute_changed?(o, algolia_object_id_method(options), false)
841
840
  changed.nil? ? false : changed
842
841
  end
843
842
 
@@ -918,7 +917,7 @@ module AlgoliaSearch
918
917
  def algolia_find_in_batches(batch_size, &block)
919
918
  if (defined?(::ActiveRecord) && ancestors.include?(::ActiveRecord::Base)) || respond_to?(:find_in_batches)
920
919
  find_in_batches(:batch_size => batch_size, &block)
921
- elsif defined?(::Sequel) && self < Sequel::Model
920
+ elsif defined?(::Sequel) && defined?(::Sequel::Model) && self < Sequel::Model
922
921
  dataset.extension(:pagination).each_page(batch_size, &block)
923
922
  else
924
923
  # don't worry, mongoid has its own underlying cursor/streaming mechanism
@@ -934,7 +933,7 @@ module AlgoliaSearch
934
933
  end
935
934
  end
936
935
 
937
- def algolia_attribute_changed?(object, attr_name)
936
+ def algolia_attribute_changed?(object, attr_name, default)
938
937
  # if one of two method is implemented, we return its result
939
938
  # true/false means whether it has changed or not
940
939
  # +#{attr_name}_changed?+ always defined for automatic attributes but deprecated after Rails 5.2
@@ -963,8 +962,8 @@ module AlgoliaSearch
963
962
  return object.send("will_save_change_to_#{attr_name}?")
964
963
  end
965
964
 
966
- # We don't know if the attribute has changed, so conservatively assume it has
967
- true
965
+ # We don't know if the attribute has changed, so return the default passed
966
+ default
968
967
  end
969
968
 
970
969
  def automatic_changed_method?(object, method_name)
@@ -1031,7 +1030,7 @@ module AlgoliaSearch
1031
1030
  # algolia_must_reindex flag is reset after every commit as part. If we must reindex at any point in
1032
1031
  # a stransaction, keep flag set until it is explicitly unset
1033
1032
  @algolia_must_reindex ||=
1034
- if defined?(::Sequel) && is_a?(Sequel::Model)
1033
+ if defined?(::Sequel) && defined?(::Sequel::Model) && is_a?(Sequel::Model)
1035
1034
  new? || self.class.algolia_must_reindex?(self)
1036
1035
  else
1037
1036
  new_record? || self.class.algolia_must_reindex?(self)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2023-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json