algoliasearch 1.24.0 → 1.25.0
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +36 -33
- data/LICENSE +1 -1
- data/README.md +53 -23
- data/lib/algolia/client.rb +29 -1
- data/lib/algolia/index.rb +1 -1
- data/lib/algolia/protocol.rb +7 -3
- data/lib/algolia/version.rb +1 -1
- data/lib/algoliasearch.rb +1 -0
- data/spec/client_spec.rb +36 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d2c8207648db3e97139f3cfa780dd809a93261375d13200293392e3c5dfb415
|
|
4
|
+
data.tar.gz: ad0cf55c0b32e1f5626c87f2d4df527812c7c5ba04470e9cab07a75dcdb6f213
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '00897df4dc73d01b3812b3612de184acea35fa4becce5a6d175c389441a7a99bf8f22b326283cfe2d7190e4cbe4f40004a55d96d45e002acfd93fe4fd6525810'
|
|
7
|
+
data.tar.gz: 054e24efa3a634eb43847d7bb36cf82e0694461db3fa5826dc945c101527027e2ae3787685367d6afad546e183cfef4ab9c8826b30d5b883c04d9317dd1d713b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.25.0](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/1.25.0) (2018-12-19)
|
|
2
|
+
|
|
3
|
+
**Added**
|
|
4
|
+
|
|
5
|
+
* Introduce Insights client to send events to Algolia Insights API - [326](https://github.com/algolia/algoliasearch-client-ruby/issues/326)
|
|
6
|
+
|
|
7
|
+
* Add `multiple_get_objects` to retrieve objects by objectID across multiple indices - [329](https://github.com/algolia/algoliasearch-client-ruby/issues/329)
|
|
8
|
+
|
|
9
|
+
**Modified**
|
|
10
|
+
|
|
11
|
+
* Use the correct `hitsPerPage` key when exporting index resources - [319](https://github.com/algolia/algoliasearch-client-ruby/issues/319)
|
|
12
|
+
|
|
1
13
|
## [1.24.0](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/1.24.0) (2018-11-28)
|
|
2
14
|
|
|
3
15
|
* Feat(adds-account-client-copy-index): adds `copy_index` to account client ([#324](https://github.com/algolia/algoliasearch-client-ruby/pull/324))
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
algoliasearch (1.
|
|
4
|
+
algoliasearch (1.24.0)
|
|
5
5
|
httpclient (~> 2.8, >= 2.8.3)
|
|
6
6
|
json (>= 1.5.1)
|
|
7
7
|
|
|
@@ -9,24 +9,24 @@ GEM
|
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
11
|
addressable (2.4.0)
|
|
12
|
-
backports (3.11.
|
|
13
|
-
coveralls (0.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
backports (3.11.1)
|
|
13
|
+
coveralls (0.7.2)
|
|
14
|
+
multi_json (~> 1.3)
|
|
15
|
+
rest-client (= 1.6.7)
|
|
16
|
+
simplecov (>= 0.7)
|
|
17
|
+
term-ansicolor (= 1.2.2)
|
|
18
|
+
thor (= 0.18.1)
|
|
19
19
|
crack (0.4.3)
|
|
20
20
|
safe_yaml (~> 1.0.0)
|
|
21
21
|
diff-lcs (1.3)
|
|
22
|
-
docile (1.3.
|
|
22
|
+
docile (1.3.0)
|
|
23
23
|
ethon (0.11.0)
|
|
24
24
|
ffi (>= 1.3.0)
|
|
25
|
-
faraday (0.
|
|
25
|
+
faraday (0.14.0)
|
|
26
26
|
multipart-post (>= 1.2, < 3)
|
|
27
27
|
faraday_middleware (0.12.2)
|
|
28
28
|
faraday (>= 0.7.4, < 1.0)
|
|
29
|
-
ffi (1.9.
|
|
29
|
+
ffi (1.9.23)
|
|
30
30
|
ffi2-generators (0.1.1)
|
|
31
31
|
gh (0.15.1)
|
|
32
32
|
addressable (~> 2.4.0)
|
|
@@ -36,11 +36,12 @@ GEM
|
|
|
36
36
|
net-http-persistent (~> 2.9)
|
|
37
37
|
net-http-pipeline
|
|
38
38
|
hashdiff (0.3.7)
|
|
39
|
-
highline (1.
|
|
39
|
+
highline (1.6.21)
|
|
40
40
|
httpclient (2.8.3)
|
|
41
41
|
json (2.1.0)
|
|
42
42
|
launchy (2.4.3)
|
|
43
43
|
addressable (~> 2.3)
|
|
44
|
+
mime-types (1.25.1)
|
|
44
45
|
multi_json (1.13.1)
|
|
45
46
|
multipart-post (2.0.0)
|
|
46
47
|
net-http-persistent (2.9.4)
|
|
@@ -49,20 +50,22 @@ GEM
|
|
|
49
50
|
json
|
|
50
51
|
websocket (~> 1.0)
|
|
51
52
|
rake (12.3.1)
|
|
52
|
-
rdoc (6.0.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
rspec-
|
|
57
|
-
|
|
58
|
-
rspec-
|
|
59
|
-
rspec-
|
|
53
|
+
rdoc (6.0.3)
|
|
54
|
+
rest-client (1.6.7)
|
|
55
|
+
mime-types (>= 1.16)
|
|
56
|
+
rspec (3.7.0)
|
|
57
|
+
rspec-core (~> 3.7.0)
|
|
58
|
+
rspec-expectations (~> 3.7.0)
|
|
59
|
+
rspec-mocks (~> 3.7.0)
|
|
60
|
+
rspec-core (3.7.1)
|
|
61
|
+
rspec-support (~> 3.7.0)
|
|
62
|
+
rspec-expectations (3.7.0)
|
|
60
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
-
rspec-support (~> 3.
|
|
62
|
-
rspec-mocks (3.
|
|
64
|
+
rspec-support (~> 3.7.0)
|
|
65
|
+
rspec-mocks (3.7.0)
|
|
63
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
64
|
-
rspec-support (~> 3.
|
|
65
|
-
rspec-support (3.
|
|
67
|
+
rspec-support (~> 3.7.0)
|
|
68
|
+
rspec-support (3.7.1)
|
|
66
69
|
rubysl (2.2.0)
|
|
67
70
|
rubysl-abbrev (~> 2.0)
|
|
68
71
|
rubysl-base64 (~> 2.0)
|
|
@@ -243,7 +246,7 @@ GEM
|
|
|
243
246
|
rubysl-singleton (2.0.0)
|
|
244
247
|
rubysl-socket (2.2.1)
|
|
245
248
|
rubysl-fcntl (~> 2.0)
|
|
246
|
-
rubysl-stringio (2.
|
|
249
|
+
rubysl-stringio (2.2)
|
|
247
250
|
rubysl-strscan (2.0.0)
|
|
248
251
|
rubysl-sync (2.0.0)
|
|
249
252
|
rubysl-syslog (2.1.0)
|
|
@@ -271,11 +274,11 @@ GEM
|
|
|
271
274
|
json (>= 1.8, < 3)
|
|
272
275
|
simplecov-html (~> 0.10.0)
|
|
273
276
|
simplecov-html (0.10.2)
|
|
274
|
-
term-ansicolor (1.
|
|
275
|
-
tins (~>
|
|
276
|
-
thor (0.
|
|
277
|
-
tins (
|
|
278
|
-
travis (1.8.
|
|
277
|
+
term-ansicolor (1.2.2)
|
|
278
|
+
tins (~> 0.8)
|
|
279
|
+
thor (0.18.1)
|
|
280
|
+
tins (0.13.2)
|
|
281
|
+
travis (1.8.8)
|
|
279
282
|
backports
|
|
280
283
|
faraday (~> 0.9)
|
|
281
284
|
faraday_middleware (~> 0.9, >= 0.9.1)
|
|
@@ -286,11 +289,11 @@ GEM
|
|
|
286
289
|
typhoeus (~> 0.6, >= 0.6.8)
|
|
287
290
|
typhoeus (0.8.0)
|
|
288
291
|
ethon (>= 0.8.0)
|
|
289
|
-
webmock (3.
|
|
292
|
+
webmock (3.3.0)
|
|
290
293
|
addressable (>= 2.3.6)
|
|
291
294
|
crack (>= 0.3.2)
|
|
292
295
|
hashdiff
|
|
293
|
-
websocket (1.2.
|
|
296
|
+
websocket (1.2.5)
|
|
294
297
|
|
|
295
298
|
PLATFORMS
|
|
296
299
|
ruby
|
|
@@ -307,4 +310,4 @@ DEPENDENCIES
|
|
|
307
310
|
webmock
|
|
308
311
|
|
|
309
312
|
BUNDLED WITH
|
|
310
|
-
1.
|
|
313
|
+
1.16.6
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -48,7 +48,7 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
|
|
|
48
48
|
|
|
49
49
|
## Install
|
|
50
50
|
|
|
51
|
-
Install
|
|
51
|
+
Install the Ruby client using [RubyGems](https://rubygems.org/):
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
gem install algoliasearch
|
|
@@ -99,13 +99,15 @@ You can also configure the list of attributes you want to index by order of impo
|
|
|
99
99
|
In this case, the order of attributes is very important to decide which hit is the best:
|
|
100
100
|
|
|
101
101
|
```ruby
|
|
102
|
-
index.set_settings
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
index.set_settings({
|
|
103
|
+
searchableAttributes: [
|
|
104
|
+
'lastname',
|
|
105
|
+
'firstname',
|
|
106
|
+
'company',
|
|
107
|
+
'email',
|
|
108
|
+
'city',
|
|
109
|
+
'address'
|
|
110
|
+
]}
|
|
109
111
|
)
|
|
110
112
|
```
|
|
111
113
|
|
|
@@ -114,13 +116,13 @@ index.set_settings searchableAttributes: %w(
|
|
|
114
116
|
You can now search for contacts using `firstname`, `lastname`, `company`, etc. (even with typos):
|
|
115
117
|
|
|
116
118
|
```ruby
|
|
117
|
-
#
|
|
119
|
+
# Search for a first name
|
|
118
120
|
puts index.search('jimmie').to_json
|
|
119
|
-
#
|
|
121
|
+
# Search for a first name with typo
|
|
120
122
|
puts index.search('jimie').to_json
|
|
121
|
-
#
|
|
123
|
+
# Search for a company
|
|
122
124
|
puts index.search('california paint').to_json
|
|
123
|
-
#
|
|
125
|
+
# Search for a first name and a company
|
|
124
126
|
puts index.search('jimmie paint').to_json
|
|
125
127
|
```
|
|
126
128
|
|
|
@@ -207,11 +209,19 @@ search.start();
|
|
|
207
209
|
|
|
208
210
|
|
|
209
211
|
|
|
212
|
+
### Personalization
|
|
213
|
+
|
|
214
|
+
- [Add strategy](https://algolia.com/doc/api-reference/api-methods/add-strategy/?language=ruby)
|
|
215
|
+
- [Get strategy](https://algolia.com/doc/api-reference/api-methods/get-strategy/?language=ruby)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
210
220
|
### Search
|
|
211
221
|
|
|
212
222
|
- [Search index](https://algolia.com/doc/api-reference/api-methods/search/?language=ruby)
|
|
213
223
|
- [Search for facet values](https://algolia.com/doc/api-reference/api-methods/search-for-facet-values/?language=ruby)
|
|
214
|
-
- [Search multiple
|
|
224
|
+
- [Search multiple indices](https://algolia.com/doc/api-reference/api-methods/multiple-queries/?language=ruby)
|
|
215
225
|
- [Browse index](https://algolia.com/doc/api-reference/api-methods/browse/?language=ruby)
|
|
216
226
|
|
|
217
227
|
|
|
@@ -220,10 +230,12 @@ search.start();
|
|
|
220
230
|
### Indexing
|
|
221
231
|
|
|
222
232
|
- [Add objects](https://algolia.com/doc/api-reference/api-methods/add-objects/?language=ruby)
|
|
223
|
-
- [
|
|
233
|
+
- [Save objects](https://algolia.com/doc/api-reference/api-methods/save-objects/?language=ruby)
|
|
224
234
|
- [Partial update objects](https://algolia.com/doc/api-reference/api-methods/partial-update-objects/?language=ruby)
|
|
225
235
|
- [Delete objects](https://algolia.com/doc/api-reference/api-methods/delete-objects/?language=ruby)
|
|
236
|
+
- [Replace all objects](https://algolia.com/doc/api-reference/api-methods/replace-all-objects/?language=ruby)
|
|
226
237
|
- [Delete by](https://algolia.com/doc/api-reference/api-methods/delete-by/?language=ruby)
|
|
238
|
+
- [Clear objects](https://algolia.com/doc/api-reference/api-methods/clear-objects/?language=ruby)
|
|
227
239
|
- [Get objects](https://algolia.com/doc/api-reference/api-methods/get-objects/?language=ruby)
|
|
228
240
|
- [Custom batch](https://algolia.com/doc/api-reference/api-methods/batch/?language=ruby)
|
|
229
241
|
|
|
@@ -234,17 +246,17 @@ search.start();
|
|
|
234
246
|
|
|
235
247
|
- [Get settings](https://algolia.com/doc/api-reference/api-methods/get-settings/?language=ruby)
|
|
236
248
|
- [Set settings](https://algolia.com/doc/api-reference/api-methods/set-settings/?language=ruby)
|
|
249
|
+
- [Copy settings](https://algolia.com/doc/api-reference/api-methods/copy-settings/?language=ruby)
|
|
237
250
|
|
|
238
251
|
|
|
239
252
|
|
|
240
253
|
|
|
241
254
|
### Manage indices
|
|
242
255
|
|
|
243
|
-
- [List
|
|
256
|
+
- [List indices](https://algolia.com/doc/api-reference/api-methods/list-indices/?language=ruby)
|
|
244
257
|
- [Delete index](https://algolia.com/doc/api-reference/api-methods/delete-index/?language=ruby)
|
|
245
258
|
- [Copy index](https://algolia.com/doc/api-reference/api-methods/copy-index/?language=ruby)
|
|
246
259
|
- [Move index](https://algolia.com/doc/api-reference/api-methods/move-index/?language=ruby)
|
|
247
|
-
- [Clear index](https://algolia.com/doc/api-reference/api-methods/clear-index/?language=ruby)
|
|
248
260
|
|
|
249
261
|
|
|
250
262
|
|
|
@@ -269,6 +281,8 @@ search.start();
|
|
|
269
281
|
- [Clear all synonyms](https://algolia.com/doc/api-reference/api-methods/clear-synonyms/?language=ruby)
|
|
270
282
|
- [Get synonym](https://algolia.com/doc/api-reference/api-methods/get-synonym/?language=ruby)
|
|
271
283
|
- [Search synonyms](https://algolia.com/doc/api-reference/api-methods/search-synonyms/?language=ruby)
|
|
284
|
+
- [Replace all synonyms](https://algolia.com/doc/api-reference/api-methods/replace-all-synonyms/?language=ruby)
|
|
285
|
+
- [Copy synonyms](https://algolia.com/doc/api-reference/api-methods/copy-synonyms/?language=ruby)
|
|
272
286
|
- [Export Synonyms](https://algolia.com/doc/api-reference/api-methods/export-synonyms/?language=ruby)
|
|
273
287
|
|
|
274
288
|
|
|
@@ -276,13 +290,15 @@ search.start();
|
|
|
276
290
|
|
|
277
291
|
### Query rules
|
|
278
292
|
|
|
279
|
-
- [Save rule](https://algolia.com/doc/api-reference/api-methods/
|
|
280
|
-
- [Batch rules](https://algolia.com/doc/api-reference/api-methods/rules
|
|
281
|
-
- [Get rule](https://algolia.com/doc/api-reference/api-methods/
|
|
282
|
-
- [Delete rule](https://algolia.com/doc/api-reference/api-methods/
|
|
283
|
-
- [Clear rules](https://algolia.com/doc/api-reference/api-methods/rules
|
|
284
|
-
- [Search rules](https://algolia.com/doc/api-reference/api-methods/rules
|
|
285
|
-
- [
|
|
293
|
+
- [Save rule](https://algolia.com/doc/api-reference/api-methods/save-rule/?language=ruby)
|
|
294
|
+
- [Batch rules](https://algolia.com/doc/api-reference/api-methods/batch-rules/?language=ruby)
|
|
295
|
+
- [Get rule](https://algolia.com/doc/api-reference/api-methods/get-rule/?language=ruby)
|
|
296
|
+
- [Delete rule](https://algolia.com/doc/api-reference/api-methods/delete-rule/?language=ruby)
|
|
297
|
+
- [Clear rules](https://algolia.com/doc/api-reference/api-methods/clear-rules/?language=ruby)
|
|
298
|
+
- [Search rules](https://algolia.com/doc/api-reference/api-methods/search-rules/?language=ruby)
|
|
299
|
+
- [Replace all rules](https://algolia.com/doc/api-reference/api-methods/replace-all-rules/?language=ruby)
|
|
300
|
+
- [Copy rules](https://algolia.com/doc/api-reference/api-methods/copy-rules/?language=ruby)
|
|
301
|
+
- [Export rules](https://algolia.com/doc/api-reference/api-methods/export-rules/?language=ruby)
|
|
286
302
|
|
|
287
303
|
|
|
288
304
|
|
|
@@ -298,6 +314,20 @@ search.start();
|
|
|
298
314
|
|
|
299
315
|
|
|
300
316
|
|
|
317
|
+
### Insights
|
|
318
|
+
|
|
319
|
+
- [Clicked Object IDs After Search](https://algolia.com/doc/api-reference/api-methods/clicked-object-ids-after-search/?language=ruby)
|
|
320
|
+
- [Clicked Object IDs](https://algolia.com/doc/api-reference/api-methods/clicked-object-ids/?language=ruby)
|
|
321
|
+
- [Clicked Filters](https://algolia.com/doc/api-reference/api-methods/clicked-filters/?language=ruby)
|
|
322
|
+
- [Converted Objects IDs After Search](https://algolia.com/doc/api-reference/api-methods/converted-object-ids-after-search/?language=ruby)
|
|
323
|
+
- [Converted Object IDs](https://algolia.com/doc/api-reference/api-methods/converted-object-ids/?language=ruby)
|
|
324
|
+
- [Converted Filters](https://algolia.com/doc/api-reference/api-methods/converted-filters/?language=ruby)
|
|
325
|
+
- [Viewed Object IDs](https://algolia.com/doc/api-reference/api-methods/viewed-object-ids/?language=ruby)
|
|
326
|
+
- [Viewed Filters](https://algolia.com/doc/api-reference/api-methods/viewed-filters/?language=ruby)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
301
331
|
### MultiClusters
|
|
302
332
|
|
|
303
333
|
- [Assign or Move userID](https://algolia.com/doc/api-reference/api-methods/assign-user-id/?language=ruby)
|
data/lib/algolia/client.rb
CHANGED
|
@@ -143,6 +143,18 @@ module Algolia
|
|
|
143
143
|
post(Protocol.multiple_queries_uri(strategy), requests.to_json, :search, request_options)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
#
|
|
147
|
+
# Get objects by objectID across multiple indexes
|
|
148
|
+
#
|
|
149
|
+
# @param requests [
|
|
150
|
+
# { "indexName" => index_name_1, "objectID" => "obj1" },
|
|
151
|
+
# { "indexName" => index_name_2, "objectID" => "obj2" }
|
|
152
|
+
# ]
|
|
153
|
+
#
|
|
154
|
+
def multiple_get_objects(requests, request_options = {})
|
|
155
|
+
post(Protocol.objects_uri, {:requests => requests}.to_json, :search, request_options)
|
|
156
|
+
end
|
|
157
|
+
|
|
146
158
|
#
|
|
147
159
|
# List all existing indexes
|
|
148
160
|
# return an Answer object with answer in the form
|
|
@@ -491,9 +503,17 @@ module Algolia
|
|
|
491
503
|
end
|
|
492
504
|
end
|
|
493
505
|
|
|
506
|
+
def get_personalization_strategy(request_options = {})
|
|
507
|
+
get(Protocol.personalization_strategy_uri, :read, request_options)
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
def set_personalization_strategy(strategy, request_options = {})
|
|
511
|
+
post(Protocol.personalization_strategy_uri, strategy.to_json, :write, request_options)
|
|
512
|
+
end
|
|
513
|
+
|
|
494
514
|
#
|
|
495
515
|
# Multicluster management
|
|
496
|
-
|
|
516
|
+
#
|
|
497
517
|
def list_clusters(request_options = {})
|
|
498
518
|
get(Protocol.clusters_uri, :read, request_options)
|
|
499
519
|
end
|
|
@@ -754,6 +774,14 @@ module Algolia
|
|
|
754
774
|
Algolia.client.multiple_queries(queries, options, strategy)
|
|
755
775
|
end
|
|
756
776
|
|
|
777
|
+
#
|
|
778
|
+
# This method allows to get objects (records) via objectID across
|
|
779
|
+
# multiple indexes with one API call
|
|
780
|
+
#
|
|
781
|
+
def Algolia.multiple_get_objects(requests, request_options = {})
|
|
782
|
+
Algolia.client.multiple_get_objects(requests, request_options)
|
|
783
|
+
end
|
|
784
|
+
|
|
757
785
|
#
|
|
758
786
|
# List all existing indexes
|
|
759
787
|
# return an Answer object with answer in the form
|
data/lib/algolia/index.rb
CHANGED
|
@@ -1020,7 +1020,7 @@ module Algolia
|
|
|
1020
1020
|
res = []
|
|
1021
1021
|
page = 0
|
|
1022
1022
|
loop do
|
|
1023
|
-
curr = search_synonyms('', { :
|
|
1023
|
+
curr = search_synonyms('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits']
|
|
1024
1024
|
curr.each do |synonym|
|
|
1025
1025
|
res << synonym
|
|
1026
1026
|
yield synonym if block_given?
|
data/lib/algolia/protocol.rb
CHANGED
|
@@ -85,7 +85,7 @@ module Algolia
|
|
|
85
85
|
|
|
86
86
|
def Protocol.partial_object_uri(index, object_id, create_if_not_exits = true)
|
|
87
87
|
params = create_if_not_exits ? '' : '?createIfNotExists=false'
|
|
88
|
-
"#{index_uri(index)}/#{CGI.escape(object_id)}/partial#{params}"
|
|
88
|
+
"#{index_uri(index)}/#{CGI.escape(object_id.to_s)}/partial#{params}"
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def Protocol.settings_uri(index, params = {})
|
|
@@ -128,7 +128,7 @@ module Algolia
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def Protocol.synonym_uri(index, object_id)
|
|
131
|
-
"#{synonyms_uri(index)}/#{CGI.escape(object_id)}"
|
|
131
|
+
"#{synonyms_uri(index)}/#{CGI.escape(object_id.to_s)}"
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
def Protocol.search_synonyms_uri(index)
|
|
@@ -148,7 +148,7 @@ module Algolia
|
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
def Protocol.rule_uri(index, object_id)
|
|
151
|
-
"#{rules_uri(index)}/#{CGI.escape(object_id)}"
|
|
151
|
+
"#{rules_uri(index)}/#{CGI.escape(object_id.to_s)}"
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
def Protocol.search_rules_uri(index)
|
|
@@ -167,6 +167,10 @@ module Algolia
|
|
|
167
167
|
"#{index_uri(index)}/deleteByQuery"
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
def Protocol.personalization_strategy_uri
|
|
171
|
+
"/1/recommendation/personalization/strategy"
|
|
172
|
+
end
|
|
173
|
+
|
|
170
174
|
def Protocol.clusters_uri
|
|
171
175
|
"/#{VERSION}/clusters"
|
|
172
176
|
end
|
data/lib/algolia/version.rb
CHANGED
data/lib/algoliasearch.rb
CHANGED
data/spec/client_spec.rb
CHANGED
|
@@ -579,6 +579,28 @@ describe 'Client' do
|
|
|
579
579
|
res["results"][0]["hits"].length.should eq(1)
|
|
580
580
|
end
|
|
581
581
|
|
|
582
|
+
it "should get multiple objectIDs" do
|
|
583
|
+
index_name_1 = safe_index_name("àlgol?a-multi")
|
|
584
|
+
index_1 = Algolia::Index.new(index_name_1)
|
|
585
|
+
index_1.save_object!({:objectID => "obj1-multi-get", :name => 'test'})
|
|
586
|
+
|
|
587
|
+
index_name_2 = safe_index_name("àlgol?a-multi")
|
|
588
|
+
index_2 = Algolia::Index.new(index_name_2)
|
|
589
|
+
index_2.save_object!({:objectID => "obj2-multi-get", :name => 'another index'})
|
|
590
|
+
|
|
591
|
+
requests = [
|
|
592
|
+
{ "indexName" => index_name_1, "objectID" => "obj1-multi-get" },
|
|
593
|
+
{ "indexName" => index_name_2, "objectID" => "obj2-multi-get" }
|
|
594
|
+
]
|
|
595
|
+
|
|
596
|
+
response = Algolia.multiple_get_objects(requests)
|
|
597
|
+
|
|
598
|
+
response['results'].count.should eq(2)
|
|
599
|
+
|
|
600
|
+
index_1.delete_index rescue "not fatal"
|
|
601
|
+
index_2.delete_index rescue "not fatal"
|
|
602
|
+
end
|
|
603
|
+
|
|
582
604
|
it "should throw if the index_name is missing in multiple_queries" do
|
|
583
605
|
expect { Algolia.multiple_queries([{"query" => ""}]) }.to raise_error(ArgumentError)
|
|
584
606
|
end
|
|
@@ -1147,6 +1169,20 @@ describe 'Client' do
|
|
|
1147
1169
|
synonyms_search.size.should eq(2)
|
|
1148
1170
|
end
|
|
1149
1171
|
|
|
1172
|
+
it 'should test synonyms Export Query' do
|
|
1173
|
+
@index.batch_synonyms! [
|
|
1174
|
+
{ :objectID => 'city', :type => 'synonym', :synonyms => ['San Francisco', 'SF'] },
|
|
1175
|
+
{ :objectID => 'us', :type => 'synonym', :synonyms => ['US', 'USA', 'Untied States of America'] },
|
|
1176
|
+
{ :objectID => 'ie', :type => 'synonym', :synonyms => ['IE', 'IRL', 'Ireland'] },
|
|
1177
|
+
{ :objectID => 'street', :type => 'altCorrection1', :word => 'street', :corrections => ['st'] }
|
|
1178
|
+
]
|
|
1179
|
+
|
|
1180
|
+
expect(@index).to receive(:search_synonyms).and_call_original.at_least(4)
|
|
1181
|
+
@index.export_synonyms(1)
|
|
1182
|
+
|
|
1183
|
+
@index.clear_synonyms!
|
|
1184
|
+
end
|
|
1185
|
+
|
|
1150
1186
|
it 'should test Query Rules' do
|
|
1151
1187
|
rule_1 = {
|
|
1152
1188
|
:objectID => '42',
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: algoliasearch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Algolia
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-12-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httpclient
|
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements: []
|
|
147
147
|
rubyforge_project:
|
|
148
|
-
rubygems_version: 2.7.
|
|
148
|
+
rubygems_version: 2.7.7
|
|
149
149
|
signing_key:
|
|
150
150
|
specification_version: 4
|
|
151
151
|
summary: A simple Ruby client for the algolia.com REST API
|