algoliasearch-rails 2.1.3 → 2.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05d79fea6be33d2b368545b05d61ff20d6c9ebc24c82c6ebce9d101b5dd6c1be
4
- data.tar.gz: 9d321dcbd147b7f566b520cc2c9f536a505451ede8a654bcb58a39aa68190b4c
3
+ metadata.gz: 6433c4f68c91187b97118401b684386ba5cdf5be16e37aaa45e650805bf7af8e
4
+ data.tar.gz: 81f4035a44f66d65e98f37630a683fef8b152a6c605f6a50974c8a37d9b518e5
5
5
  SHA512:
6
- metadata.gz: 90c767d7f18c8b3c4262851b76b7a2ce1985b54b0b865ce735f9730f13f0680884965999a055e2b8a20912e9bdc777395100df71639888e38a6c4a315629f5ab
7
- data.tar.gz: 3bbe879c074ca6debba2c4966917595f7f530f3c5a625d43958e00e73927495ebf183e711067c3ae2cdef4e7eb89c6b26357dab48ae1bf71a18eac6f07396345
6
+ metadata.gz: fa288fd052a2ff08ba427128c42e313563bf8e6c54cb7e4347c1e526e981806c4cd8d77bf91865fac3c9d2d84b1591ee628cbbd1d0e043b1a3b1b45d3f6e227a
7
+ data.tar.gz: 2baff463707d56ab0937b3887eeb61b2833d2ee79e06a550211e32a14adb364a6129a89d61384cfa5b788cba8086f297d1fcdecdde7bdba75978286a35f2491f
data/CHANGELOG.MD CHANGED
@@ -1,6 +1,33 @@
1
1
  # CHANGELOG
2
2
 
3
- ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.1.3...master)
3
+ ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...master)
4
+
5
+ ## [2.2.1](https://github.com/algolia/algoliasearch-rails/compare/2.2.0...2.2.1)
6
+ ### Fixed
7
+ * fix:settings changes detection issue with empty array [`#424`](https://github.com/algolia/algoliasearch-rails/pull/424)
8
+ * fix: settings changes detection issue for replica indexes with inherit option [`#426`](https://github.com/algolia/algoliasearch-rails/pull/426)
9
+ * fix: make sync opt to be selectable for auto setting update logic [`#425`](https://github.com/algolia/algoliasearch-rails/pull/425)
10
+
11
+ ### Added
12
+ * Add relevancyStrictness to IndexSettings [`#427`](https://github.com/algolia/algoliasearch-rails/pull/427)
13
+
14
+ ## [2.2.0](https://github.com/algolia/algoliasearch-rails/compare/2.1.4...2.2.0)
15
+ ### Added
16
+ * Support to pass Algolia API client options [`#420`](https://github.com/algolia/algoliasearch-rails/pull/420)
17
+
18
+ ### Fixed
19
+ * Issue with `FrozenError` for newer Ruby versions [`#418`](https://github.com/algolia/algoliasearch-rails/pull/418)
20
+ * Only check index settings when indexing is enabled [`#416`](https://github.com/algolia/algoliasearch-rails/pull/416)
21
+ * Index intialization documentation [`#419`](https://github.com/algolia/algoliasearch-rails/pull/419)
22
+
23
+ ## [2.1.4](https://github.com/algolia/algoliasearch-rails/compare/2.1.4...2.1.3)
24
+ ### Fixed
25
+ - File formatting [`#414`](https://github.com/algolia/algoliasearch-rails/pull/414)
26
+ - Document supported Rails versions [`#407`](https://github.com/algolia/algoliasearch-rails/pull/407)
27
+ - Fixed error when using `:check_settings => false` [`#413`](https://github.com/algolia/algoliasearch-rails/pull/413)
28
+
29
+ ### Removed
30
+ - Old references to TravisCI [`#408`](https://github.com/algolia/algoliasearch-rails/pull/408)
4
31
 
5
32
  ## [2.1.3](https://github.com/algolia/algoliasearch-rails/compare/2.1.3...2.1.2)
6
33
  ### Fixed
data/Gemfile CHANGED
@@ -27,7 +27,6 @@ group :test do
27
27
  end
28
28
 
29
29
  group :development do
30
- gem 'travis'
31
30
  gem 'rake', '~> 10.1.0'
32
31
  gem 'rdoc'
33
32
  end
data/Gemfile.lock CHANGED
@@ -1,162 +1,167 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actioncable (6.1.3.1)
5
- actionpack (= 6.1.3.1)
6
- activesupport (= 6.1.3.1)
4
+ actioncable (6.1.4.7)
5
+ actionpack (= 6.1.4.7)
6
+ activesupport (= 6.1.4.7)
7
7
  nio4r (~> 2.0)
8
8
  websocket-driver (>= 0.6.1)
9
- actionmailbox (6.1.3.1)
10
- actionpack (= 6.1.3.1)
11
- activejob (= 6.1.3.1)
12
- activerecord (= 6.1.3.1)
13
- activestorage (= 6.1.3.1)
14
- activesupport (= 6.1.3.1)
9
+ actionmailbox (6.1.4.7)
10
+ actionpack (= 6.1.4.7)
11
+ activejob (= 6.1.4.7)
12
+ activerecord (= 6.1.4.7)
13
+ activestorage (= 6.1.4.7)
14
+ activesupport (= 6.1.4.7)
15
15
  mail (>= 2.7.1)
16
- actionmailer (6.1.3.1)
17
- actionpack (= 6.1.3.1)
18
- actionview (= 6.1.3.1)
19
- activejob (= 6.1.3.1)
20
- activesupport (= 6.1.3.1)
16
+ actionmailer (6.1.4.7)
17
+ actionpack (= 6.1.4.7)
18
+ actionview (= 6.1.4.7)
19
+ activejob (= 6.1.4.7)
20
+ activesupport (= 6.1.4.7)
21
21
  mail (~> 2.5, >= 2.5.4)
22
22
  rails-dom-testing (~> 2.0)
23
- actionpack (6.1.3.1)
24
- actionview (= 6.1.3.1)
25
- activesupport (= 6.1.3.1)
23
+ actionpack (6.1.4.7)
24
+ actionview (= 6.1.4.7)
25
+ activesupport (= 6.1.4.7)
26
26
  rack (~> 2.0, >= 2.0.9)
27
27
  rack-test (>= 0.6.3)
28
28
  rails-dom-testing (~> 2.0)
29
29
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
30
- actiontext (6.1.3.1)
31
- actionpack (= 6.1.3.1)
32
- activerecord (= 6.1.3.1)
33
- activestorage (= 6.1.3.1)
34
- activesupport (= 6.1.3.1)
30
+ actiontext (6.1.4.7)
31
+ actionpack (= 6.1.4.7)
32
+ activerecord (= 6.1.4.7)
33
+ activestorage (= 6.1.4.7)
34
+ activesupport (= 6.1.4.7)
35
35
  nokogiri (>= 1.8.5)
36
- actionview (6.1.3.1)
37
- activesupport (= 6.1.3.1)
36
+ actionview (6.1.4.7)
37
+ activesupport (= 6.1.4.7)
38
38
  builder (~> 3.1)
39
39
  erubi (~> 1.4)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
42
- active_model_serializers (0.10.12)
43
- actionpack (>= 4.1, < 6.2)
44
- activemodel (>= 4.1, < 6.2)
42
+ active_model_serializers (0.10.13)
43
+ actionpack (>= 4.1, < 7.1)
44
+ activemodel (>= 4.1, < 7.1)
45
45
  case_transform (>= 0.2)
46
46
  jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
47
- activejob (6.1.3.1)
48
- activesupport (= 6.1.3.1)
47
+ activejob (6.1.4.7)
48
+ activesupport (= 6.1.4.7)
49
49
  globalid (>= 0.3.6)
50
- activemodel (6.1.3.1)
51
- activesupport (= 6.1.3.1)
52
- activerecord (6.1.3.1)
53
- activemodel (= 6.1.3.1)
54
- activesupport (= 6.1.3.1)
55
- activestorage (6.1.3.1)
56
- actionpack (= 6.1.3.1)
57
- activejob (= 6.1.3.1)
58
- activerecord (= 6.1.3.1)
59
- activesupport (= 6.1.3.1)
50
+ activemodel (6.1.4.7)
51
+ activesupport (= 6.1.4.7)
52
+ activerecord (6.1.4.7)
53
+ activemodel (= 6.1.4.7)
54
+ activesupport (= 6.1.4.7)
55
+ activestorage (6.1.4.7)
56
+ actionpack (= 6.1.4.7)
57
+ activejob (= 6.1.4.7)
58
+ activerecord (= 6.1.4.7)
59
+ activesupport (= 6.1.4.7)
60
60
  marcel (~> 1.0.0)
61
- mini_mime (~> 1.0.2)
62
- activesupport (6.1.3.1)
61
+ mini_mime (>= 1.1.0)
62
+ activesupport (6.1.4.7)
63
63
  concurrent-ruby (~> 1.0, >= 1.0.2)
64
64
  i18n (>= 1.6, < 2)
65
65
  minitest (>= 5.1)
66
66
  tzinfo (~> 2.0)
67
67
  zeitwerk (~> 2.3)
68
- addressable (2.4.0)
69
- algolia (2.0.4)
68
+ algolia (2.2.2)
70
69
  faraday (>= 0.15, < 2.0)
71
70
  multi_json (~> 1.0)
72
71
  net-http-persistent
73
- backports (3.21.0)
74
72
  builder (3.2.4)
75
73
  case_transform (0.2)
76
74
  activesupport
77
- concurrent-ruby (1.1.8)
75
+ concurrent-ruby (1.1.10)
76
+ connection_pool (2.2.5)
78
77
  crass (1.0.6)
79
- diff-lcs (1.4.4)
78
+ diff-lcs (1.5.0)
80
79
  erubi (1.10.0)
81
- ethon (0.13.0)
82
- ffi (>= 1.15.0)
83
- faraday (0.17.4)
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)
91
+ 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)
84
97
  multipart-post (>= 1.2, < 3)
85
- faraday_middleware (0.14.0)
86
- faraday (>= 0.7.4, < 1.0)
87
- ffi (1.15.0)
88
- gh (0.15.1)
89
- addressable (~> 2.4.0)
90
- backports
91
- faraday (~> 0.8)
92
- multi_json (~> 1.0)
93
- net-http-persistent (~> 2.9)
94
- net-http-pipeline
95
- globalid (0.4.2)
96
- activesupport (>= 4.2.0)
97
- highline (1.7.10)
98
- i18n (1.8.10)
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)
104
+ activesupport (>= 5.0)
105
+ i18n (1.10.0)
99
106
  concurrent-ruby (~> 1.0)
100
- json (2.5.1)
107
+ json (2.6.1)
101
108
  jsonapi-renderer (0.2.2)
102
109
  kaminari (0.17.0)
103
110
  actionpack (>= 3.0.0)
104
111
  activesupport (>= 3.0.0)
105
- launchy (2.4.3)
106
- addressable (~> 2.3)
107
- loofah (2.9.1)
112
+ loofah (2.16.0)
108
113
  crass (~> 1.0.2)
109
114
  nokogiri (>= 1.5.9)
110
115
  mail (2.7.1)
111
116
  mini_mime (>= 0.1.1)
112
- marcel (1.0.1)
117
+ marcel (1.0.2)
113
118
  method_source (1.0.0)
114
- mini_mime (1.0.3)
115
- mini_portile2 (2.5.0)
116
- minitest (5.14.4)
119
+ mini_mime (1.1.2)
120
+ mini_portile2 (2.8.0)
121
+ minitest (5.15.0)
117
122
  multi_json (1.15.0)
118
123
  multipart-post (2.1.1)
119
- net-http-persistent (2.9.4)
120
- net-http-pipeline (1.0.1)
121
- nio4r (2.5.7)
122
- nokogiri (1.11.3)
123
- mini_portile2 (~> 2.5.0)
124
+ net-http-persistent (4.0.1)
125
+ connection_pool (~> 2.2)
126
+ nio4r (2.5.8)
127
+ nokogiri (1.13.4)
128
+ mini_portile2 (~> 2.8.0)
124
129
  racc (~> 1.4)
125
- pusher-client (0.6.2)
126
- json
127
- websocket (~> 1.0)
128
- racc (1.5.2)
130
+ psych (4.0.3)
131
+ stringio
132
+ racc (1.6.0)
129
133
  rack (2.2.3)
130
134
  rack-test (1.1.0)
131
135
  rack (>= 1.0, < 3)
132
- rails (6.1.3.1)
133
- actioncable (= 6.1.3.1)
134
- actionmailbox (= 6.1.3.1)
135
- actionmailer (= 6.1.3.1)
136
- actionpack (= 6.1.3.1)
137
- actiontext (= 6.1.3.1)
138
- actionview (= 6.1.3.1)
139
- activejob (= 6.1.3.1)
140
- activemodel (= 6.1.3.1)
141
- activerecord (= 6.1.3.1)
142
- activestorage (= 6.1.3.1)
143
- activesupport (= 6.1.3.1)
136
+ rails (6.1.4.7)
137
+ actioncable (= 6.1.4.7)
138
+ actionmailbox (= 6.1.4.7)
139
+ actionmailer (= 6.1.4.7)
140
+ actionpack (= 6.1.4.7)
141
+ actiontext (= 6.1.4.7)
142
+ actionview (= 6.1.4.7)
143
+ activejob (= 6.1.4.7)
144
+ activemodel (= 6.1.4.7)
145
+ activerecord (= 6.1.4.7)
146
+ activestorage (= 6.1.4.7)
147
+ activesupport (= 6.1.4.7)
144
148
  bundler (>= 1.15.0)
145
- railties (= 6.1.3.1)
149
+ railties (= 6.1.4.7)
146
150
  sprockets-rails (>= 2.0.0)
147
151
  rails-dom-testing (2.0.3)
148
152
  activesupport (>= 4.2.0)
149
153
  nokogiri (>= 1.6)
150
- rails-html-sanitizer (1.3.0)
154
+ rails-html-sanitizer (1.4.2)
151
155
  loofah (~> 2.3)
152
- railties (6.1.3.1)
153
- actionpack (= 6.1.3.1)
154
- activesupport (= 6.1.3.1)
156
+ railties (6.1.4.7)
157
+ actionpack (= 6.1.4.7)
158
+ activesupport (= 6.1.4.7)
155
159
  method_source
156
- rake (>= 0.8.7)
160
+ rake (>= 0.13)
157
161
  thor (~> 1.0)
158
162
  rake (10.1.1)
159
- rdoc (6.3.0)
163
+ rdoc (6.4.0)
164
+ psych (>= 4.0.0)
160
165
  redgreen (1.2.2)
161
166
  rspec (2.99.0)
162
167
  rspec-core (~> 2.99.0)
@@ -166,35 +171,25 @@ GEM
166
171
  rspec-expectations (2.99.2)
167
172
  diff-lcs (>= 1.1.3, < 2.0)
168
173
  rspec-mocks (2.99.4)
169
- sequel (5.43.0)
170
- sprockets (4.0.2)
174
+ ruby2_keywords (0.0.5)
175
+ sequel (5.55.0)
176
+ sprockets (4.0.3)
171
177
  concurrent-ruby (~> 1.0)
172
178
  rack (> 1, < 3)
173
- sprockets-rails (3.2.2)
174
- actionpack (>= 4.0)
175
- activesupport (>= 4.0)
179
+ sprockets-rails (3.4.2)
180
+ actionpack (>= 5.2)
181
+ activesupport (>= 5.2)
176
182
  sprockets (>= 3.0.0)
177
183
  sqlite3 (1.4.2)
178
- thor (1.1.0)
179
- travis (1.8.13)
180
- backports
181
- faraday (~> 0.9)
182
- faraday_middleware (~> 0.9, >= 0.9.1)
183
- gh (~> 0.13)
184
- highline (~> 1.6)
185
- launchy (~> 2.1)
186
- pusher-client (~> 0.4)
187
- typhoeus (~> 0.6, >= 0.6.8)
188
- typhoeus (0.8.0)
189
- ethon (>= 0.8.0)
184
+ stringio (3.0.1)
185
+ thor (1.2.1)
190
186
  tzinfo (2.0.4)
191
187
  concurrent-ruby (~> 1.0)
192
- websocket (1.2.9)
193
- websocket-driver (0.7.3)
188
+ websocket-driver (0.7.5)
194
189
  websocket-extensions (>= 0.1.0)
195
190
  websocket-extensions (0.1.5)
196
- will_paginate (3.3.0)
197
- zeitwerk (2.4.2)
191
+ will_paginate (3.3.1)
192
+ zeitwerk (2.5.4)
198
193
 
199
194
  PLATFORMS
200
195
  ruby
@@ -214,8 +209,7 @@ DEPENDENCIES
214
209
  rspec (>= 2.5.0, < 3.0)
215
210
  sequel (>= 4.0)
216
211
  sqlite3 (~> 1.4.0)
217
- travis
218
212
  will_paginate (>= 2.3.15)
219
213
 
220
214
  BUNDLED WITH
221
- 2.1.4
215
+ 1.17.2
data/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
  This gem let you easily integrate the Algolia Search API to your favorite ORM. It's based on the [algoliasearch-client-ruby](https://github.com/algolia/algoliasearch-client-ruby) gem.
29
- Rails 3.x, 4.x and 5.x are all supported.
29
+ Rails 5.x and 6.x are supported.
30
30
 
31
31
  You might be interested in the sample Ruby on Rails application providing a `autocomplete.js`-based auto-completion and `InstantSearch.js`-based instant search results page: [algoliasearch-rails-example](https://github.com/algolia/algoliasearch-rails-example/).
32
32
 
@@ -517,7 +517,7 @@ class MySidekiqWorker
517
517
  if remove
518
518
  # the record has likely already been removed from your database so we cannot
519
519
  # use ActiveRecord#find to load it
520
- index = Algolia::Index.new("index_name")
520
+ index = AlgoliaSearch.client.init_index("index_name")
521
521
  index.delete_object(id)
522
522
  else
523
523
  # the record should be present
@@ -550,7 +550,7 @@ class MySidekiqWorker
550
550
  if remove
551
551
  # the record has likely already been removed from your database so we cannot
552
552
  # use ActiveRecord#find to load it
553
- index = Algolia::Index.new("index_name")
553
+ index = AlgoliaSearch.client.init_index("index_name")
554
554
  index.delete_object(id)
555
555
  else
556
556
  # the record should be present
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  ".document",
23
23
  ".rspec",
24
- ".travis.yml",
25
24
  "CHANGELOG.MD",
26
25
  "Gemfile",
27
26
  "Gemfile.lock",
@@ -82,7 +81,6 @@ Gem::Specification.new do |s|
82
81
  s.add_runtime_dependency(%q<algolia>, ["< 3.0.0"])
83
82
  s.add_development_dependency(%q<will_paginate>, [">= 2.3.15"])
84
83
  s.add_development_dependency(%q<kaminari>, [">= 0"])
85
- s.add_development_dependency "travis"
86
84
  s.add_development_dependency "rake"
87
85
  s.add_development_dependency "rdoc"
88
86
  else
@@ -15,6 +15,14 @@ module AlgoliaSearch
15
15
  )
16
16
  end
17
17
 
18
+ def client_opts
19
+ @@opts ||= {}
20
+ end
21
+
22
+ def client_opts=(opts)
23
+ @@opts = opts
24
+ end
25
+
18
26
  def client
19
27
  if @client.nil?
20
28
  setup_client
@@ -24,7 +32,7 @@ module AlgoliaSearch
24
32
  end
25
33
 
26
34
  def setup_client
27
- @client = Algolia::Search::Client.create_with_config(Algolia::Search::Config.new(@@configuration))
35
+ @client = Algolia::Search::Client.new(Algolia::Search::Config.new(@@configuration), client_opts)
28
36
  end
29
37
  end
30
38
  end
@@ -1,3 +1,3 @@
1
1
  module AlgoliaSearch
2
- VERSION = '2.1.3'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -54,7 +54,7 @@ module AlgoliaSearch
54
54
  # Attributes
55
55
  :searchableAttributes, :attributesForFaceting, :unretrievableAttributes, :attributesToRetrieve,
56
56
  # Ranking
57
- :ranking, :customRanking, # Replicas are handled via `add_replica`
57
+ :ranking, :customRanking, :relevancyStrictness, # Replicas are handled via `add_replica`
58
58
  # Faceting
59
59
  :maxValuesPerFacet, :sortFacetValuesBy,
60
60
  # Highlighting / Snippeting
@@ -211,7 +211,7 @@ module AlgoliaSearch
211
211
  def encode_attributes(v)
212
212
  case v
213
213
  when String
214
- v.force_encoding('utf-8')
214
+ v.dup.force_encoding('utf-8')
215
215
  when Hash
216
216
  v.each { |key, value| v[key] = encode_attributes(value) }
217
217
  when Array
@@ -533,6 +533,7 @@ module AlgoliaSearch
533
533
  # fetch the master settings
534
534
  master_index = algolia_ensure_init(options, settings)
535
535
  master_settings = master_index.get_settings rescue {} # if master doesn't exist yet
536
+ master_exists = master_settings != {}
536
537
  master_settings.merge!(JSON.parse(settings.to_settings.to_json)) # convert symbols to strings
537
538
 
538
539
  # remove the replicas of the temporary index
@@ -546,14 +547,14 @@ module AlgoliaSearch
546
547
  tmp_options.delete(:per_environment) # already included in the temporary index_name
547
548
  tmp_settings = settings.dup
548
549
 
549
- if options[:check_settings] == false
550
- @client.copy_index!(src_index_name, tmp_index_name, %w(settings synonyms rules))
550
+ if options[:check_settings] == false && master_exists
551
+ AlgoliaSearch.client.copy_index!(src_index_name, tmp_index_name, { scope: %w[settings synonyms rules] })
551
552
  tmp_index = SafeIndex.new(tmp_index_name, !!options[:raise_on_failure])
552
553
  else
553
554
  tmp_index = algolia_ensure_init(tmp_options, tmp_settings, master_settings)
554
555
  end
555
556
 
556
- algolia_find_in_batches(batch_size) do |group|
557
+ algolia_find_in_batches(batch_size) do |group|
557
558
  if algolia_conditional_index?(options)
558
559
  # select only indexable objects
559
560
  group = group.select { |o| algolia_indexable?(o, tmp_options) }
@@ -788,18 +789,19 @@ module AlgoliaSearch
788
789
 
789
790
  index_settings ||= settings.to_settings
790
791
  index_settings = options[:primary_settings].to_settings.merge(index_settings) if options[:inherit]
792
+ replicas = index_settings.delete(:replicas) ||
793
+ index_settings.delete('replicas')
794
+ index_settings[:replicas] = replicas unless replicas.nil? || options[:inherit]
791
795
 
792
796
  options[:check_settings] = true if options[:check_settings].nil?
793
797
 
794
- current_settings = if options[:check_settings]
798
+ current_settings = if options[:check_settings] && !algolia_indexing_disabled?(options)
795
799
  @algolia_indexes[settings].get_settings(:getVersion => 1) rescue nil # if the index doesn't exist
796
800
  end
797
801
 
798
802
  if !algolia_indexing_disabled?(options) && options[:check_settings] && algoliasearch_settings_changed?(current_settings, index_settings)
799
- replicas = index_settings.delete(:replicas) ||
800
- index_settings.delete('replicas')
801
- index_settings[:replicas] = replicas unless replicas.nil? || options[:inherit]
802
- @algolia_indexes[settings].set_settings!(index_settings)
803
+ set_settings_method = options[:synchronous] ? :set_settings! : :set_settings
804
+ @algolia_indexes[settings].send(set_settings_method, index_settings)
803
805
  end
804
806
 
805
807
  @algolia_indexes[settings]
@@ -846,6 +848,8 @@ module AlgoliaSearch
846
848
  if v.is_a?(Array) and prev_v.is_a?(Array)
847
849
  # compare array of strings, avoiding symbols VS strings comparison
848
850
  return true if v.map { |x| x.to_s } != prev_v.map { |x| x.to_s }
851
+ elsif v.blank? # blank? check is needed to compare [] and null
852
+ return true unless prev_v.blank?
849
853
  else
850
854
  return true if prev_v != v
851
855
  end
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.1.3
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: travis
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +105,6 @@ extra_rdoc_files:
119
105
  files:
120
106
  - ".document"
121
107
  - ".rspec"
122
- - ".travis.yml"
123
108
  - CHANGELOG.MD
124
109
  - Gemfile
125
110
  - Gemfile.lock
@@ -182,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
167
  - !ruby/object:Gem::Version
183
168
  version: '0'
184
169
  requirements: []
185
- rubygems_version: 3.0.6
170
+ rubygems_version: 3.0.3.1
186
171
  signing_key:
187
172
  specification_version: 4
188
173
  summary: AlgoliaSearch integration to your favorite ORM
data/.travis.yml DELETED
@@ -1,62 +0,0 @@
1
- language: ruby
2
-
3
- branches:
4
- only:
5
- - master
6
-
7
- matrix:
8
- include:
9
- - rvm: 1.8.7
10
- env: RAILS_VERSION=3.2.0 SEQUEL_VERSION=4.0
11
- dist: trusty
12
- - rvm: 1.9.3
13
- env: RAILS_VERSION=3.2.0
14
- - rvm: 1.9.3
15
- env: RAILS_VERSION=4.2
16
- - rvm: 2.2.9
17
- env: RAILS_VERSION=3.2.0
18
- - rvm: 2.2.9
19
- env: RAILS_VERSION=4.2
20
- - rvm: 2.2.9
21
- env: RAILS_VERSION=5.1
22
- - rvm: 2.3.6
23
- env: RAILS_VERSION=3.2.0
24
- - rvm: 2.3.6
25
- env: RAILS_VERSION=4.2
26
- - rvm: 2.3.6
27
- env: RAILS_VERSION=5.1
28
- - rvm: 2.4.3
29
- env: RAILS_VERSION=4.2
30
- - rvm: 2.4.3
31
- env: RAILS_VERSION=5.1 SEQUEL_VERSION=4.0
32
- - rvm: 2.4.3
33
- env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
34
- - rvm: 2.5.3
35
- env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
36
- - rvm: 2.5.3
37
- env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
38
- - rvm: 2.6.0
39
- env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
40
- - rvm: 2.6.0
41
- env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
42
- - rvm: 2.7.0
43
- env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
44
- - rvm: 2.7.0
45
- env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
46
-
47
- before_install:
48
- - wget http://api-key-dealer.herokuapp.com/clients/algolia-keys && chmod +x algolia-keys
49
- - which bundle || true
50
- - find /home/travis/.rvm -wholename "*/bundler-*.gemspec" -print -delete || true
51
- - bundle --version || true
52
- - gem uninstall bundler || true
53
- - bundle --version || true
54
- - gem install bundler -v 1.17.3
55
- - bundle --version
56
-
57
- install: rm -f Gemfile.lock && bundle install --without development
58
-
59
- cache: bundler
60
-
61
- script:
62
- - eval $(./algolia-keys export) && bundle exec rake