algoliasearch-rails 2.1.4 → 2.2.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: a93eb9160dcd68998d5f05a33a788a8737888c07d14c3e9fa1d3e36c758b6117
4
- data.tar.gz: b397ac486ee7514abd0612bf80f28d37c09299441e1aeb5cf363a9c48d627fd7
3
+ metadata.gz: 0c549fa24b75d5e52bf7001edee7b6d7b8b46084cd16d4707af78be3dfaa03d4
4
+ data.tar.gz: d10d27cd89d87269ad334001ddd924b0e2f3cdb4154a4c28db5597d42a7051f6
5
5
  SHA512:
6
- metadata.gz: f6b148d577533959db2df41f33169ad9df554287a771057fa5a980e8804ac40282cee2e49f50342de89d08806890766e88f06b94ea7a456496cc637cbdbc4a4a
7
- data.tar.gz: 5dcea86a0adfbbef31067f679116873b2e30317950eac88dd9a6e9f9100ccfea1190d630ddd34cbca88d9c05ffa8b01e27550c5e371c0816a12461ccef97fac2
6
+ metadata.gz: c75d84557cd8d7f4a7d97ffa5d641f2fbe2ee2eae58b4c638450a1db90b79b63f806c6244ff611a97527607de623d85e4babf4bad26d7ce84bb3ddca2eb55bb5
7
+ data.tar.gz: 3cfa9329b1036799f81b22b7f1f67ab0a72f4a62faad2ef5a85dd2909c695c14d089d22473a34e560fe4ba3617cb40e8b9d061115ad4611c81a475dc08220d9d
data/CHANGELOG.MD CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.1.4...master)
4
4
 
5
+ ## [2.2.0](https://github.com/algolia/algoliasearch-rails/compare/2.1.4...2.2.0)
6
+ ### Added
7
+ * Support to pass Algolia API client options [`#420`](https://github.com/algolia/algoliasearch-rails/pull/420)
8
+
9
+ ### Fixed
10
+ * Issue with `FrozenError` for newer Ruby versions [`#418`](https://github.com/algolia/algoliasearch-rails/pull/418)
11
+ * Only check index settings when indexing is enabled [`#416`](https://github.com/algolia/algoliasearch-rails/pull/416)
12
+ * Index intialization documentation [`#419`](https://github.com/algolia/algoliasearch-rails/pull/419)
13
+
5
14
  ## [2.1.4](https://github.com/algolia/algoliasearch-rails/compare/2.1.4...2.1.3)
6
15
  ### Fixed
7
16
  - File formatting [`#414`](https://github.com/algolia/algoliasearch-rails/pull/414)
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.6)
5
+ actionpack (= 6.1.4.6)
6
+ activesupport (= 6.1.4.6)
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.6)
10
+ actionpack (= 6.1.4.6)
11
+ activejob (= 6.1.4.6)
12
+ activerecord (= 6.1.4.6)
13
+ activestorage (= 6.1.4.6)
14
+ activesupport (= 6.1.4.6)
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.6)
17
+ actionpack (= 6.1.4.6)
18
+ actionview (= 6.1.4.6)
19
+ activejob (= 6.1.4.6)
20
+ activesupport (= 6.1.4.6)
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.6)
24
+ actionview (= 6.1.4.6)
25
+ activesupport (= 6.1.4.6)
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.6)
31
+ actionpack (= 6.1.4.6)
32
+ activerecord (= 6.1.4.6)
33
+ activestorage (= 6.1.4.6)
34
+ activesupport (= 6.1.4.6)
35
35
  nokogiri (>= 1.8.5)
36
- actionview (6.1.3.1)
37
- activesupport (= 6.1.3.1)
36
+ actionview (6.1.4.6)
37
+ activesupport (= 6.1.4.6)
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.6)
48
+ activesupport (= 6.1.4.6)
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.6)
51
+ activesupport (= 6.1.4.6)
52
+ activerecord (6.1.4.6)
53
+ activemodel (= 6.1.4.6)
54
+ activesupport (= 6.1.4.6)
55
+ activestorage (6.1.4.6)
56
+ actionpack (= 6.1.4.6)
57
+ activejob (= 6.1.4.6)
58
+ activerecord (= 6.1.4.6)
59
+ activesupport (= 6.1.4.6)
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.6)
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.9)
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.14.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.3)
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.6)
137
+ actioncable (= 6.1.4.6)
138
+ actionmailbox (= 6.1.4.6)
139
+ actionmailer (= 6.1.4.6)
140
+ actionpack (= 6.1.4.6)
141
+ actiontext (= 6.1.4.6)
142
+ actionview (= 6.1.4.6)
143
+ activejob (= 6.1.4.6)
144
+ activemodel (= 6.1.4.6)
145
+ activerecord (= 6.1.4.6)
146
+ activestorage (= 6.1.4.6)
147
+ activesupport (= 6.1.4.6)
144
148
  bundler (>= 1.15.0)
145
- railties (= 6.1.3.1)
149
+ railties (= 6.1.4.6)
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.6)
157
+ actionpack (= 6.1.4.6)
158
+ activesupport (= 6.1.4.6)
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.54.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,7 +209,6 @@ 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
data/README.md CHANGED
@@ -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
@@ -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.4'
2
+ VERSION = '2.2.0'
3
3
  end
@@ -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,7 +547,7 @@ 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
+ if options[:check_settings] == false && master_exists
550
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
@@ -791,7 +792,7 @@ module AlgoliaSearch
791
792
 
792
793
  options[:check_settings] = true if options[:check_settings].nil?
793
794
 
794
- current_settings = if options[:check_settings]
795
+ current_settings = if options[:check_settings] && !algolia_indexing_disabled?(options)
795
796
  @algolia_indexes[settings].get_settings(:getVersion => 1) rescue nil # if the index doesn't exist
796
797
  end
797
798
 
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.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-13 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json