algoliasearch-rails 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzJhNzkwMzY2NzdkNDAzOTBmY2EyNDU4N2FmYzJiMDlkMTVhYzE4NA==
5
- data.tar.gz: !binary |-
6
- ZjBkYjBkOGJiODAwMjM4MzI3YTU4MWEwNGI1NmJlYWM1MzhmNjFiMA==
2
+ SHA1:
3
+ metadata.gz: bf08d07243a3d74246859ea6ffc628167493e478
4
+ data.tar.gz: b6841af0c6e1130d63d10d4898340b689c9cc17a
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YmYwYmU4NTcwMmE1YWZmMWZkOTZjODU5MzhlYWExY2U0ZmFlMmQxNDg5MjFk
10
- NWY3NmRmMzY5ZTU5MWJjY2Y4ZDgyN2IxM2MxMjc3NzBiZWVkYTFlZTEzYjM4
11
- YmMxZWU2MmI3ZmQ1NTRhNmQ1YjJiMWVjYmZmOTFhZmIyOTg3MDM=
12
- data.tar.gz: !binary |-
13
- YjZhMWQ0YzU0NmQ2YTkwYTYwYzFlNDg1ODdjMjBmMmNiY2RlMmViNTViOGY2
14
- NGFkOGQ4Y2QyNzhjZGNkNDJjNDZlYjY3MTAyZGZjYTY4YmNhMzI2YTQzODg4
15
- OWE0NjBlZTdiMmJkYjZlNzVkYmM5MzM2YjU0NTcxNzFjYmJiN2U=
6
+ metadata.gz: 7914bb0f6903704f247cf14e935551c47191f8e01dc4a1060c02a2a7246191a2def4867a7972565bd627697714d0cc5395f21b457e308c4cbd0e07bf2854c598
7
+ data.tar.gz: 4d258c1e6f77bd4a06602e77eaaaf68882d05bd515c78e0c1e7cc0b118f4e15d06be01ff8fbf0c1d7e071d94fe1fe3353dac307958d2579da3bc986cc30a4179
data/ChangeLog CHANGED
@@ -1,5 +1,10 @@
1
1
  CHANGELOG
2
2
 
3
+ 2017-03-13 1.19.0
4
+
5
+ * Rewrote the algoliasearch:reindex rake task to better detect models to reindex
6
+ * Fixed the handling of `raise_on_failture` for class methods
7
+
3
8
  2017-02-16 1.18.0
4
9
 
5
10
  * Add new replica parameter, `inherit` (#198)
@@ -1,77 +1,85 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actioncable (5.0.0)
5
- actionpack (= 5.0.0)
6
- nio4r (~> 1.2)
4
+ actioncable (5.0.2)
5
+ actionpack (= 5.0.2)
6
+ nio4r (>= 1.2, < 3.0)
7
7
  websocket-driver (~> 0.6.1)
8
- actionmailer (5.0.0)
9
- actionpack (= 5.0.0)
10
- actionview (= 5.0.0)
11
- activejob (= 5.0.0)
8
+ actionmailer (5.0.2)
9
+ actionpack (= 5.0.2)
10
+ actionview (= 5.0.2)
11
+ activejob (= 5.0.2)
12
12
  mail (~> 2.5, >= 2.5.4)
13
13
  rails-dom-testing (~> 2.0)
14
- actionpack (5.0.0)
15
- actionview (= 5.0.0)
16
- activesupport (= 5.0.0)
14
+ actionpack (5.0.2)
15
+ actionview (= 5.0.2)
16
+ activesupport (= 5.0.2)
17
17
  rack (~> 2.0)
18
18
  rack-test (~> 0.6.3)
19
19
  rails-dom-testing (~> 2.0)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.0.0)
22
- activesupport (= 5.0.0)
21
+ actionview (5.0.2)
22
+ activesupport (= 5.0.2)
23
23
  builder (~> 3.1)
24
24
  erubis (~> 2.7.0)
25
25
  rails-dom-testing (~> 2.0)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- activejob (5.0.0)
28
- activesupport (= 5.0.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
+ activejob (5.0.2)
28
+ activesupport (= 5.0.2)
29
29
  globalid (>= 0.3.6)
30
- activemodel (5.0.0)
31
- activesupport (= 5.0.0)
32
- activerecord (5.0.0)
33
- activemodel (= 5.0.0)
34
- activesupport (= 5.0.0)
30
+ activemodel (5.0.2)
31
+ activesupport (= 5.0.2)
32
+ activerecord (5.0.2)
33
+ activemodel (= 5.0.2)
34
+ activesupport (= 5.0.2)
35
35
  arel (~> 7.0)
36
- activesupport (5.0.0)
36
+ activesupport (5.0.2)
37
37
  concurrent-ruby (~> 1.0, >= 1.0.2)
38
38
  i18n (~> 0.7)
39
39
  minitest (~> 5.1)
40
40
  tzinfo (~> 1.1)
41
41
  addressable (2.4.0)
42
- algoliasearch (1.12.4)
43
- httpclient (~> 2.8.2.4)
42
+ algoliasearch (1.12.7)
43
+ httpclient (~> 2.8.3)
44
44
  json (>= 1.5.1)
45
- arel (7.1.0)
45
+ arel (7.1.4)
46
46
  backports (3.6.8)
47
- builder (3.2.2)
48
- concurrent-ruby (1.0.2)
49
- diff-lcs (1.2.5)
47
+ builder (3.2.3)
48
+ concurrent-ruby (1.0.5)
49
+ diff-lcs (1.3)
50
50
  erubis (2.7.0)
51
- ethon (0.9.0)
51
+ ethon (0.10.1)
52
52
  ffi (>= 1.3.0)
53
- faraday (0.9.2)
53
+ faraday (0.11.0)
54
54
  multipart-post (>= 1.2, < 3)
55
- faraday_middleware (0.10.0)
56
- faraday (>= 0.7.4, < 0.10)
57
- ffi (1.9.14)
58
- ffi2-generators (0.1.1)
59
- gh (0.14.0)
60
- addressable
55
+ faraday_middleware (0.11.0.1)
56
+ faraday (>= 0.7.4, < 1.0)
57
+ ffi (1.9.18)
58
+ gh (0.15.0)
59
+ addressable (~> 2.4.0)
61
60
  backports
62
61
  faraday (~> 0.8)
63
62
  multi_json (~> 1.0)
64
- net-http-persistent (>= 2.7)
63
+ net-http-persistent (~> 2.9)
65
64
  net-http-pipeline
66
- globalid (0.3.6)
65
+ globalid (0.3.7)
67
66
  activesupport (>= 4.1.0)
68
67
  highline (1.7.8)
69
- httpclient (2.8.2.4)
70
- i18n (0.7.0)
71
- json (1.8.3)
72
- kaminari (0.17.0)
73
- actionpack (>= 3.0.0)
74
- activesupport (>= 3.0.0)
68
+ httpclient (2.8.3)
69
+ i18n (0.8.1)
70
+ json (1.8.6)
71
+ kaminari (1.0.1)
72
+ activesupport (>= 4.1.0)
73
+ kaminari-actionview (= 1.0.1)
74
+ kaminari-activerecord (= 1.0.1)
75
+ kaminari-core (= 1.0.1)
76
+ kaminari-actionview (1.0.1)
77
+ actionview
78
+ kaminari-core (= 1.0.1)
79
+ kaminari-activerecord (1.0.1)
80
+ activerecord
81
+ kaminari-core (= 1.0.1)
82
+ kaminari-core (1.0.1)
75
83
  launchy (2.4.3)
76
84
  addressable (~> 2.3)
77
85
  loofah (2.0.3)
@@ -83,48 +91,45 @@ GEM
83
91
  mime-types-data (~> 3.2015)
84
92
  mime-types-data (3.2016.0521)
85
93
  mini_portile2 (2.1.0)
86
- minitest (5.9.0)
94
+ minitest (5.10.1)
87
95
  multi_json (1.12.1)
88
96
  multipart-post (2.0.0)
89
97
  net-http-persistent (2.9.4)
90
98
  net-http-pipeline (1.0.1)
91
- nio4r (1.2.1)
92
- nokogiri (1.6.8)
99
+ nio4r (2.0.0)
100
+ nokogiri (1.7.0.1)
93
101
  mini_portile2 (~> 2.1.0)
94
- pkg-config (~> 1.1.7)
95
- pkg-config (1.1.7)
96
102
  pusher-client (0.6.2)
97
103
  json
98
104
  websocket (~> 1.0)
99
105
  rack (2.0.1)
100
106
  rack-test (0.6.3)
101
107
  rack (>= 1.0)
102
- rails (5.0.0)
103
- actioncable (= 5.0.0)
104
- actionmailer (= 5.0.0)
105
- actionpack (= 5.0.0)
106
- actionview (= 5.0.0)
107
- activejob (= 5.0.0)
108
- activemodel (= 5.0.0)
109
- activerecord (= 5.0.0)
110
- activesupport (= 5.0.0)
108
+ rails (5.0.2)
109
+ actioncable (= 5.0.2)
110
+ actionmailer (= 5.0.2)
111
+ actionpack (= 5.0.2)
112
+ actionview (= 5.0.2)
113
+ activejob (= 5.0.2)
114
+ activemodel (= 5.0.2)
115
+ activerecord (= 5.0.2)
116
+ activesupport (= 5.0.2)
111
117
  bundler (>= 1.3.0, < 2.0)
112
- railties (= 5.0.0)
118
+ railties (= 5.0.2)
113
119
  sprockets-rails (>= 2.0.0)
114
- rails-dom-testing (2.0.1)
120
+ rails-dom-testing (2.0.2)
115
121
  activesupport (>= 4.2.0, < 6.0)
116
- nokogiri (~> 1.6.0)
122
+ nokogiri (~> 1.6)
117
123
  rails-html-sanitizer (1.0.3)
118
124
  loofah (~> 2.0)
119
- railties (5.0.0)
120
- actionpack (= 5.0.0)
121
- activesupport (= 5.0.0)
125
+ railties (5.0.2)
126
+ actionpack (= 5.0.2)
127
+ activesupport (= 5.0.2)
122
128
  method_source
123
129
  rake (>= 0.8.7)
124
130
  thor (>= 0.18.1, < 2.0)
125
131
  rake (10.1.1)
126
- rdoc (4.2.2)
127
- json (~> 1.4)
132
+ rdoc (5.1.0)
128
133
  redgreen (1.2.2)
129
134
  rspec (2.99.0)
130
135
  rspec-core (~> 2.99.0)
@@ -134,220 +139,18 @@ GEM
134
139
  rspec-expectations (2.99.2)
135
140
  diff-lcs (>= 1.1.3, < 2.0)
136
141
  rspec-mocks (2.99.4)
137
- rubysl (2.2.0)
138
- rubysl-abbrev (~> 2.0)
139
- rubysl-base64 (~> 2.0)
140
- rubysl-benchmark (~> 2.0)
141
- rubysl-bigdecimal (~> 2.0)
142
- rubysl-cgi (~> 2.0)
143
- rubysl-cgi-session (~> 2.0)
144
- rubysl-cmath (~> 2.0)
145
- rubysl-complex (~> 2.0)
146
- rubysl-continuation (~> 2.0)
147
- rubysl-coverage (~> 2.0)
148
- rubysl-csv (~> 2.0)
149
- rubysl-curses (~> 2.0)
150
- rubysl-date (~> 2.0)
151
- rubysl-delegate (~> 2.0)
152
- rubysl-digest (~> 2.0)
153
- rubysl-drb (~> 2.0)
154
- rubysl-e2mmap (~> 2.0)
155
- rubysl-english (~> 2.0)
156
- rubysl-enumerator (~> 2.0)
157
- rubysl-erb (~> 2.0)
158
- rubysl-etc (~> 2.0)
159
- rubysl-expect (~> 2.0)
160
- rubysl-fcntl (~> 2.0)
161
- rubysl-fiber (~> 2.0)
162
- rubysl-fileutils (~> 2.0)
163
- rubysl-find (~> 2.0)
164
- rubysl-forwardable (~> 2.0)
165
- rubysl-getoptlong (~> 2.0)
166
- rubysl-gserver (~> 2.0)
167
- rubysl-io-console (~> 2.0)
168
- rubysl-io-nonblock (~> 2.0)
169
- rubysl-io-wait (~> 2.0)
170
- rubysl-ipaddr (~> 2.0)
171
- rubysl-irb (~> 2.1)
172
- rubysl-logger (~> 2.0)
173
- rubysl-mathn (~> 2.0)
174
- rubysl-matrix (~> 2.0)
175
- rubysl-mkmf (~> 2.0)
176
- rubysl-monitor (~> 2.0)
177
- rubysl-mutex_m (~> 2.0)
178
- rubysl-net-ftp (~> 2.0)
179
- rubysl-net-http (~> 2.0)
180
- rubysl-net-imap (~> 2.0)
181
- rubysl-net-pop (~> 2.0)
182
- rubysl-net-protocol (~> 2.0)
183
- rubysl-net-smtp (~> 2.0)
184
- rubysl-net-telnet (~> 2.0)
185
- rubysl-nkf (~> 2.0)
186
- rubysl-observer (~> 2.0)
187
- rubysl-open-uri (~> 2.0)
188
- rubysl-open3 (~> 2.0)
189
- rubysl-openssl (~> 2.0)
190
- rubysl-optparse (~> 2.0)
191
- rubysl-ostruct (~> 2.0)
192
- rubysl-pathname (~> 2.0)
193
- rubysl-prettyprint (~> 2.0)
194
- rubysl-prime (~> 2.0)
195
- rubysl-profile (~> 2.0)
196
- rubysl-profiler (~> 2.0)
197
- rubysl-pstore (~> 2.0)
198
- rubysl-pty (~> 2.0)
199
- rubysl-rational (~> 2.0)
200
- rubysl-resolv (~> 2.0)
201
- rubysl-rexml (~> 2.0)
202
- rubysl-rinda (~> 2.0)
203
- rubysl-rss (~> 2.0)
204
- rubysl-scanf (~> 2.0)
205
- rubysl-securerandom (~> 2.0)
206
- rubysl-set (~> 2.0)
207
- rubysl-shellwords (~> 2.0)
208
- rubysl-singleton (~> 2.0)
209
- rubysl-socket (~> 2.0)
210
- rubysl-stringio (~> 2.0)
211
- rubysl-strscan (~> 2.0)
212
- rubysl-sync (~> 2.0)
213
- rubysl-syslog (~> 2.0)
214
- rubysl-tempfile (~> 2.0)
215
- rubysl-thread (~> 2.0)
216
- rubysl-thwait (~> 2.0)
217
- rubysl-time (~> 2.0)
218
- rubysl-timeout (~> 2.0)
219
- rubysl-tmpdir (~> 2.0)
220
- rubysl-tsort (~> 2.0)
221
- rubysl-un (~> 2.0)
222
- rubysl-unicode_normalize (~> 2.0)
223
- rubysl-uri (~> 2.0)
224
- rubysl-weakref (~> 2.0)
225
- rubysl-webrick (~> 2.0)
226
- rubysl-xmlrpc (~> 2.0)
227
- rubysl-yaml (~> 2.0)
228
- rubysl-zlib (~> 2.0)
229
- rubysl-abbrev (2.0.4)
230
- rubysl-base64 (2.0.0)
231
- rubysl-benchmark (2.0.1)
232
- rubysl-bigdecimal (2.0.2)
233
- rubysl-cgi (2.0.1)
234
- rubysl-cgi-session (2.1.0)
235
- rubysl-cmath (2.0.0)
236
- rubysl-complex (2.0.0)
237
- rubysl-continuation (2.0.0)
238
- rubysl-coverage (2.1)
239
- rubysl-csv (2.0.2)
240
- rubysl-english (~> 2.0)
241
- rubysl-curses (2.0.1)
242
- rubysl-date (2.0.9)
243
- rubysl-delegate (2.0.1)
244
- rubysl-digest (2.0.8)
245
- rubysl-drb (2.0.1)
246
- rubysl-e2mmap (2.0.0)
247
- rubysl-english (2.0.0)
248
- rubysl-enumerator (2.0.0)
249
- rubysl-erb (2.0.2)
250
- rubysl-etc (2.0.3)
251
- ffi2-generators (~> 0.1)
252
- rubysl-expect (2.0.0)
253
- rubysl-fcntl (2.0.4)
254
- ffi2-generators (~> 0.1)
255
- rubysl-fiber (2.0.0)
256
- rubysl-fileutils (2.0.3)
257
- rubysl-find (2.0.1)
258
- rubysl-forwardable (2.0.1)
259
- rubysl-getoptlong (2.0.0)
260
- rubysl-gserver (2.0.0)
261
- rubysl-socket (~> 2.0)
262
- rubysl-thread (~> 2.0)
263
- rubysl-io-console (2.0.0)
264
- rubysl-io-nonblock (2.0.0)
265
- rubysl-io-wait (2.0.0)
266
- rubysl-ipaddr (2.0.0)
267
- rubysl-irb (2.1.1)
268
- rubysl-e2mmap (~> 2.0)
269
- rubysl-mathn (~> 2.0)
270
- rubysl-thread (~> 2.0)
271
- rubysl-logger (2.1.0)
272
- rubysl-mathn (2.0.0)
273
- rubysl-matrix (2.1.0)
274
- rubysl-e2mmap (~> 2.0)
275
- rubysl-mkmf (2.1)
276
- rubysl-fileutils (~> 2.0)
277
- rubysl-shellwords (~> 2.0)
278
- rubysl-monitor (2.0.0)
279
- rubysl-mutex_m (2.0.0)
280
- rubysl-net-ftp (2.0.1)
281
- rubysl-net-http (2.0.4)
282
- rubysl-cgi (~> 2.0)
283
- rubysl-erb (~> 2.0)
284
- rubysl-singleton (~> 2.0)
285
- rubysl-net-imap (2.0.1)
286
- rubysl-net-pop (2.0.1)
287
- rubysl-net-protocol (2.0.1)
288
- rubysl-net-smtp (2.0.1)
289
- rubysl-net-telnet (2.0.0)
290
- rubysl-nkf (2.0.1)
291
- rubysl-observer (2.0.0)
292
- rubysl-open-uri (2.0.0)
293
- rubysl-open3 (2.0.0)
294
- rubysl-openssl (2.8.0)
295
- rubysl-optparse (2.0.1)
296
- rubysl-shellwords (~> 2.0)
297
- rubysl-ostruct (2.1.0)
298
- rubysl-pathname (2.3)
299
- rubysl-prettyprint (2.0.3)
300
- rubysl-prime (2.0.1)
301
- rubysl-profile (2.0.0)
302
- rubysl-profiler (2.1)
303
- rubysl-pstore (2.0.0)
304
- rubysl-pty (2.0.3)
305
- rubysl-rational (2.0.1)
306
- rubysl-resolv (2.1.2)
307
- rubysl-rexml (2.0.4)
308
- rubysl-rinda (2.0.1)
309
- rubysl-rss (2.0.0)
310
- rubysl-scanf (2.0.0)
311
- rubysl-securerandom (2.0.0)
312
- rubysl-set (2.0.1)
313
- rubysl-shellwords (2.0.0)
314
- rubysl-singleton (2.0.0)
315
- rubysl-socket (2.1.2)
316
- rubysl-fcntl (~> 2.0)
317
- rubysl-stringio (2.1.0)
318
- rubysl-strscan (2.0.0)
319
- rubysl-sync (2.0.0)
320
- rubysl-syslog (2.1.0)
321
- ffi2-generators (~> 0.1)
322
- rubysl-tempfile (2.0.1)
323
- rubysl-thread (2.0.3)
324
- rubysl-thwait (2.0.0)
325
- rubysl-time (2.0.3)
326
- rubysl-timeout (2.0.0)
327
- rubysl-tmpdir (2.0.1)
328
- rubysl-tsort (2.0.1)
329
- rubysl-un (2.0.0)
330
- rubysl-fileutils (~> 2.0)
331
- rubysl-optparse (~> 2.0)
332
- rubysl-unicode_normalize (2.0)
333
- rubysl-uri (2.0.0)
334
- rubysl-weakref (2.0.0)
335
- rubysl-webrick (2.0.0)
336
- rubysl-xmlrpc (2.0.0)
337
- rubysl-yaml (2.1.0)
338
- rubysl-zlib (2.0.1)
339
- sequel (4.36.0)
340
- sprockets (3.7.0)
142
+ sequel (4.44.0)
143
+ sprockets (3.7.1)
341
144
  concurrent-ruby (~> 1.0)
342
145
  rack (> 1, < 3)
343
- sprockets-rails (3.1.1)
146
+ sprockets-rails (3.2.0)
344
147
  actionpack (>= 4.0)
345
148
  activesupport (>= 4.0)
346
149
  sprockets (>= 3.0.0)
347
- sqlite3 (1.3.11)
348
- thor (0.19.1)
349
- thread_safe (0.3.5)
350
- travis (1.8.2)
150
+ sqlite3 (1.3.13)
151
+ thor (0.19.4)
152
+ thread_safe (0.3.6)
153
+ travis (1.8.8)
351
154
  backports
352
155
  faraday (~> 0.9)
353
156
  faraday_middleware (~> 0.9, >= 0.9.1)
@@ -360,11 +163,11 @@ GEM
360
163
  ethon (>= 0.8.0)
361
164
  tzinfo (1.2.2)
362
165
  thread_safe (~> 0.1)
363
- websocket (1.2.3)
364
- websocket-driver (0.6.4)
166
+ websocket (1.2.4)
167
+ websocket-driver (0.6.5)
365
168
  websocket-extensions (>= 0.1.0)
366
169
  websocket-extensions (0.1.2)
367
- will_paginate (3.1.0)
170
+ will_paginate (3.1.5)
368
171
 
369
172
  PLATFORMS
370
173
  ruby
@@ -381,7 +184,6 @@ DEPENDENCIES
381
184
  rdoc
382
185
  redgreen
383
186
  rspec (>= 2.5.0, < 3.0)
384
- rubysl (~> 2.0)
385
187
  sequel
386
188
  sqlite3
387
189
  travis
data/README.md CHANGED
@@ -44,7 +44,7 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
44
44
 
45
45
  1. **[Options](#options)**
46
46
 
47
- * [Auto-indexing & asynchronism](#auto-indexing--asynchronism)
47
+ * [Auto-indexing &amp; asynchronism](#auto-indexing--asynchronism)
48
48
  * [Custom index name](#custom-index-name)
49
49
  * [Per-environment indices](#per-environment-indices)
50
50
  * [Custom attribute definition](#custom-attribute-definition)
@@ -912,7 +912,7 @@ index = Contact.index
912
912
 
913
913
  ## Primary/replica
914
914
 
915
- You can define replica indices using the <code>add_replica</code> method.
915
+ You can define replica indices using the <code>add_replica</code> method.
916
916
  Use `inherit: true` on the replica block if you want it to inherit from the primary settings.
917
917
 
918
918
  ```ruby
@@ -929,9 +929,9 @@ class Book < ActiveRecord::Base
929
929
  searchableAttributes [:author]
930
930
  end
931
931
 
932
- # define a replica index to search by `editor` only
933
- add_replica 'Book_by_editor', inherit: true, per_environment: true do
934
- searchableAttributes [:editor]
932
+ # define a replica index with custom ordering but same settings than the main block
933
+ add_replica 'Book_custom_order', inherit: true, per_environment: true do
934
+ customRanking ['asc(rank)']
935
935
  end
936
936
  end
937
937
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.18.0
1
+ 1.19.0
@@ -288,7 +288,7 @@ module AlgoliaSearch
288
288
 
289
289
  ::Algolia::Index.instance_methods(false).each do |m|
290
290
  define_method(m) do |*args, &block|
291
- SafeIndex.log_or_throw(m) do
291
+ SafeIndex.log_or_throw(m, @raise_on_failure) do
292
292
  @index.send(m, *args, &block)
293
293
  end
294
294
  end
@@ -297,14 +297,14 @@ module AlgoliaSearch
297
297
  # special handling of wait_task to handle null task_id
298
298
  def wait_task(task_id)
299
299
  return if task_id.nil? && !@raise_on_failure # ok
300
- SafeIndex.log_or_throw(:wait_task) do
300
+ SafeIndex.log_or_throw(:wait_task, @raise_on_failure) do
301
301
  @index.wait_task(task_id)
302
302
  end
303
303
  end
304
304
 
305
305
  # special handling of get_settings to avoid raising errors on 404
306
306
  def get_settings(*args)
307
- SafeIndex.log_or_throw(:get_settings) do
307
+ SafeIndex.log_or_throw(:get_settings, @raise_on_failure) do
308
308
  begin
309
309
  @index.get_settings(*args)
310
310
  rescue Algolia::AlgoliaError => e
@@ -316,17 +316,17 @@ module AlgoliaSearch
316
316
 
317
317
  # expose move as well
318
318
  def self.move_index(old_name, new_name)
319
- SafeIndex.log_or_throw(:move_index) do
319
+ SafeIndex.log_or_throw(:move_index, true) do
320
320
  ::Algolia.move_index(old_name, new_name)
321
321
  end
322
322
  end
323
323
 
324
324
  private
325
- def self.log_or_throw(method, &block)
325
+ def self.log_or_throw(method, raise_on_failure, &block)
326
326
  begin
327
327
  yield
328
328
  rescue Algolia::AlgoliaError => e
329
- raise e if @raise_on_failure
329
+ raise e if raise_on_failure
330
330
  # log the error
331
331
  (Rails.logger || Logger.new(STDOUT)).error("[algoliasearch-rails] #{e.message}")
332
332
  # return something
@@ -2,7 +2,6 @@ namespace :algoliasearch do
2
2
 
3
3
  desc "Reindex all models"
4
4
  task :reindex => :environment do
5
- puts "reindexing all models"
6
5
  AlgoliaSearch::Utilities.reindex_all_models
7
6
  end
8
7
 
@@ -2,7 +2,9 @@ module AlgoliaSearch
2
2
  module Utilities
3
3
  class << self
4
4
  def get_model_classes
5
- AlgoliaSearch.included_in ? AlgoliaSearch.included_in : []
5
+ Rails.application.eager_load! # Ensure all models are loaded (not necessary in production when cache_classes is true).
6
+
7
+ ActiveRecord::Base.descendants.select{ |model| model.respond_to?(:algolia_reindex) }
6
8
  end
7
9
 
8
10
  def clear_all_indexes
@@ -12,8 +14,18 @@ module AlgoliaSearch
12
14
  end
13
15
 
14
16
  def reindex_all_models
15
- get_model_classes.each do |klass|
16
- klass.reindex
17
+ klasses = get_model_classes
18
+
19
+ puts ''
20
+ puts "Reindexing #{klasses.count} models: #{klasses.to_sentence}."
21
+ puts ''
22
+
23
+ klasses.each do |klass|
24
+ say "#{klass}:"
25
+
26
+ say "Reindexing #{klass.count} records...", true
27
+
28
+ klass.algolia_reindex
17
29
  end
18
30
  end
19
31
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.5.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: algoliasearch
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.12.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.12.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: will_paginate
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.3.15
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.3.15
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: kaminari
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: travis
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rdoc
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: AlgoliaSearch integration to your favorite ORM
@@ -117,9 +117,9 @@ extra_rdoc_files:
117
117
  - LICENSE
118
118
  - README.md
119
119
  files:
120
- - .document
121
- - .rspec
122
- - .travis.yml
120
+ - ".document"
121
+ - ".rspec"
122
+ - ".travis.yml"
123
123
  - ChangeLog
124
124
  - Gemfile
125
125
  - Gemfile.lock
@@ -173,17 +173,17 @@ require_paths:
173
173
  - lib
174
174
  required_ruby_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ! '>='
176
+ - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ! '>='
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.6.10
186
+ rubygems_version: 2.6.8
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: AlgoliaSearch integration to your favorite ORM