algoliasearch 1.3.1 → 1.4.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
  SHA1:
3
- metadata.gz: 6815aa98febd670b9ee776ed86899d1b1f813c4b
4
- data.tar.gz: f5a69438b609bcbe2e70b04fb53c60c51ad007c9
3
+ metadata.gz: 60f96e5a2607dcefc2d61bfd860ee85334fc4974
4
+ data.tar.gz: 13a0e314c0fb5df77b4189030e6505e76a7f8924
5
5
  SHA512:
6
- metadata.gz: 5226f954185110c75e6d6c12081139a574f9e1f6fd3579d53d92e32d48e959dde1dd2da8a4407fe0980a2b6b44852e97b0ba6eaee5ab1517ea9dbf433ed0601d
7
- data.tar.gz: c2fa093f6517079ad36aba007bdcf59eb0f6f91209160aaa6c4ebc72a795c4ac44d30f47a45afb0fb41942623f262a0ddaeadaa4e789345daa503b609ee52f4c
6
+ metadata.gz: 84e2f40e68e6a1114196025eba308416ddcf6156d4bec2bf99cba69a5d0420d279c0d1294df2200eb07c6dc5d0749d3ff943f1c17f80ed62e707799e20dcb796
7
+ data.tar.gz: b2fd8567ef442cd5b987a684fb56a5c83d5b753034a62dffdc551b16a69862ea92d733a95eda3ddf532d2b99105ea8761c48a86e48e8f9fb57a8d58617cef635
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --color
2
+ --format d
data/.travis.yml CHANGED
@@ -4,9 +4,15 @@ branches:
4
4
  - master
5
5
  rvm:
6
6
  - 1.8.7
7
- - 2.1.0
8
- - 2.0.0
9
7
  - 1.9.3
8
+ - 2.0.0
9
+ - 2.1.0
10
+ - 2.1.1
11
+ - 2.1.2
12
+ - 2.1.3
13
+ - 2.1.4
14
+ - 2.1.5
15
+ - 2.2.0
10
16
  - jruby
11
17
  - rbx-2
12
18
  install:
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  CHANGELOG
2
2
 
3
+ 2015-03-17 1.4.0
4
+ * High-available DNS: search queries are now targeting "APPID-DSN.algolia.net" first, then the main cluster using NSOne, then the main cluster using Route53.
5
+ Indexing queries are targeting "APPID.algolia.net" first, then the main cluster using NSOne, then the main cluster using Route53.
6
+
3
7
  2014-11-29 1.3.1
4
8
  * Fixed wrong deployed version (1.3.0 was based on 1.2.13 instead of 1.2.14)
5
9
 
data/Gemfile CHANGED
@@ -5,13 +5,16 @@ gem 'json', '>= 1.5.1'
5
5
  gem 'rubysl', '~> 2.0', :platform => :rbx
6
6
 
7
7
  group :development do
8
+ gem 'highline', '< 1.7.0'
8
9
  gem 'coveralls'
10
+ gem 'safe_yaml', '~> 1.0.4'
11
+ gem 'rest-client', '1.6.8'
9
12
  gem 'travis'
10
13
  gem 'rake'
11
14
  gem 'rdoc'
12
15
  end
13
16
 
14
- group :test do
17
+ group :test do
15
18
  gem 'rspec', '>= 2.5.0'
16
19
  gem 'autotest'
17
20
  gem 'autotest-fsevent'
data/Gemfile.lock CHANGED
@@ -1,35 +1,35 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- ZenTest (4.10.0)
5
- addressable (2.3.6)
4
+ ZenTest (4.11.0)
5
+ addressable (2.3.7)
6
6
  autotest (4.4.6)
7
7
  ZenTest (>= 4.4.1)
8
- autotest-fsevent (0.2.9)
8
+ autotest-fsevent (0.2.10)
9
9
  sys-uname
10
10
  autotest-growl (0.2.16)
11
- backports (3.6.0)
11
+ backports (3.6.4)
12
12
  coderay (1.1.0)
13
- coveralls (0.7.0)
14
- multi_json (~> 1.3)
15
- rest-client
16
- simplecov (>= 0.7)
17
- term-ansicolor
18
- thor
13
+ coveralls (0.7.11)
14
+ multi_json (~> 1.10)
15
+ rest-client (>= 1.6.8, < 2)
16
+ simplecov (~> 0.9.1)
17
+ term-ansicolor (~> 1.3)
18
+ thor (~> 0.19.1)
19
19
  crack (0.4.2)
20
20
  safe_yaml (~> 1.0.0)
21
21
  diff-lcs (1.2.5)
22
- docile (1.1.3)
23
- ethon (0.7.0)
22
+ docile (1.1.5)
23
+ ethon (0.7.3)
24
24
  ffi (>= 1.3.0)
25
- faraday (0.9.0)
25
+ faraday (0.9.1)
26
26
  multipart-post (>= 1.2, < 3)
27
27
  faraday_middleware (0.9.1)
28
28
  faraday (>= 0.7.4, < 0.10)
29
- ffi (1.9.3)
30
- ffi (1.9.3-java)
29
+ ffi (1.9.6)
30
+ ffi (1.9.6-java)
31
31
  ffi2-generators (0.1.1)
32
- gh (0.13.2)
32
+ gh (0.14.0)
33
33
  addressable
34
34
  backports
35
35
  faraday (~> 0.8)
@@ -37,12 +37,12 @@ GEM
37
37
  net-http-persistent (>= 2.7)
38
38
  net-http-pipeline
39
39
  highline (1.6.21)
40
- httpclient (2.4.0)
41
- json (1.8.1)
42
- json (1.8.1-java)
43
- launchy (2.4.2)
40
+ httpclient (2.6.0.1)
41
+ json (1.8.2)
42
+ json (1.8.2-java)
43
+ launchy (2.4.3)
44
44
  addressable (~> 2.3)
45
- launchy (2.4.2-java)
45
+ launchy (2.4.3-java)
46
46
  addressable (~> 2.3)
47
47
  spoon (~> 0.0.1)
48
48
  method_source (0.8.2)
@@ -63,25 +63,27 @@ GEM
63
63
  pusher-client (0.6.0)
64
64
  json
65
65
  websocket (~> 1.0)
66
- rake (10.3.2)
67
- rdoc (4.1.1)
66
+ rake (10.4.2)
67
+ rdoc (4.2.0)
68
68
  json (~> 1.4)
69
69
  redgreen (1.2.2)
70
- rest-client (1.6.7)
71
- mime-types (>= 1.16)
72
- rspec (3.0.0)
73
- rspec-core (~> 3.0.0)
74
- rspec-expectations (~> 3.0.0)
75
- rspec-mocks (~> 3.0.0)
76
- rspec-core (3.0.0)
77
- rspec-support (~> 3.0.0)
78
- rspec-expectations (3.0.0)
70
+ rest-client (1.6.8)
71
+ mime-types (~> 1.16)
72
+ rdoc (>= 2.4.2)
73
+ rspec (3.2.0)
74
+ rspec-core (~> 3.2.0)
75
+ rspec-expectations (~> 3.2.0)
76
+ rspec-mocks (~> 3.2.0)
77
+ rspec-core (3.2.1)
78
+ rspec-support (~> 3.2.0)
79
+ rspec-expectations (3.2.0)
79
80
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.0.0)
81
- rspec-mocks (3.0.0)
82
- rspec-support (~> 3.0.0)
83
- rspec-support (3.0.0)
84
- rubysl (2.0.15)
81
+ rspec-support (~> 3.2.0)
82
+ rspec-mocks (3.2.1)
83
+ diff-lcs (>= 1.2.0, < 2.0)
84
+ rspec-support (~> 3.2.0)
85
+ rspec-support (3.2.2)
86
+ rubysl (2.1.0)
85
87
  rubysl-abbrev (~> 2.0)
86
88
  rubysl-base64 (~> 2.0)
87
89
  rubysl-benchmark (~> 2.0)
@@ -115,7 +117,7 @@ GEM
115
117
  rubysl-io-nonblock (~> 2.0)
116
118
  rubysl-io-wait (~> 2.0)
117
119
  rubysl-ipaddr (~> 2.0)
118
- rubysl-irb (~> 2.0)
120
+ rubysl-irb (~> 2.1)
119
121
  rubysl-logger (~> 2.0)
120
122
  rubysl-mathn (~> 2.0)
121
123
  rubysl-matrix (~> 2.0)
@@ -144,7 +146,6 @@ GEM
144
146
  rubysl-pstore (~> 2.0)
145
147
  rubysl-pty (~> 2.0)
146
148
  rubysl-rational (~> 2.0)
147
- rubysl-readline (~> 2.0)
148
149
  rubysl-resolv (~> 2.0)
149
150
  rubysl-rexml (~> 2.0)
150
151
  rubysl-rinda (~> 2.0)
@@ -186,14 +187,14 @@ GEM
186
187
  rubysl-csv (2.0.2)
187
188
  rubysl-english (~> 2.0)
188
189
  rubysl-curses (2.0.1)
189
- rubysl-date (2.0.6)
190
+ rubysl-date (2.0.9)
190
191
  rubysl-delegate (2.0.1)
191
192
  rubysl-digest (2.0.3)
192
193
  rubysl-drb (2.0.1)
193
194
  rubysl-e2mmap (2.0.0)
194
195
  rubysl-english (2.0.0)
195
196
  rubysl-enumerator (2.0.0)
196
- rubysl-erb (2.0.1)
197
+ rubysl-erb (2.0.2)
197
198
  rubysl-etc (2.0.3)
198
199
  ffi2-generators (~> 0.1)
199
200
  rubysl-expect (2.0.0)
@@ -211,12 +212,11 @@ GEM
211
212
  rubysl-io-nonblock (2.0.0)
212
213
  rubysl-io-wait (2.0.0)
213
214
  rubysl-ipaddr (2.0.0)
214
- rubysl-irb (2.0.4)
215
+ rubysl-irb (2.1.1)
215
216
  rubysl-e2mmap (~> 2.0)
216
217
  rubysl-mathn (~> 2.0)
217
- rubysl-readline (~> 2.0)
218
218
  rubysl-thread (~> 2.0)
219
- rubysl-logger (2.0.0)
219
+ rubysl-logger (2.1.0)
220
220
  rubysl-mathn (2.0.0)
221
221
  rubysl-matrix (2.1.0)
222
222
  rubysl-e2mmap (~> 2.0)
@@ -239,21 +239,20 @@ GEM
239
239
  rubysl-observer (2.0.0)
240
240
  rubysl-open-uri (2.0.0)
241
241
  rubysl-open3 (2.0.0)
242
- rubysl-openssl (2.1.0)
242
+ rubysl-openssl (2.2.1)
243
243
  rubysl-optparse (2.0.1)
244
244
  rubysl-shellwords (~> 2.0)
245
245
  rubysl-ostruct (2.0.4)
246
- rubysl-pathname (2.0.0)
246
+ rubysl-pathname (2.1.0)
247
247
  rubysl-prettyprint (2.0.3)
248
248
  rubysl-prime (2.0.1)
249
249
  rubysl-profile (2.0.0)
250
250
  rubysl-profiler (2.0.1)
251
251
  rubysl-pstore (2.0.0)
252
- rubysl-pty (2.0.2)
252
+ rubysl-pty (2.0.3)
253
253
  rubysl-rational (2.0.1)
254
- rubysl-readline (2.0.2)
255
- rubysl-resolv (2.1.0)
256
- rubysl-rexml (2.0.2)
254
+ rubysl-resolv (2.1.2)
255
+ rubysl-rexml (2.0.4)
257
256
  rubysl-rinda (2.0.1)
258
257
  rubysl-rss (2.0.0)
259
258
  rubysl-scanf (2.0.0)
@@ -265,10 +264,10 @@ GEM
265
264
  rubysl-stringio (2.0.0)
266
265
  rubysl-strscan (2.0.0)
267
266
  rubysl-sync (2.0.0)
268
- rubysl-syslog (2.0.1)
267
+ rubysl-syslog (2.1.0)
269
268
  ffi2-generators (~> 0.1)
270
269
  rubysl-tempfile (2.0.1)
271
- rubysl-thread (2.0.2)
270
+ rubysl-thread (2.0.3)
272
271
  rubysl-thwait (2.0.0)
273
272
  rubysl-time (2.0.3)
274
273
  rubysl-timeout (2.0.0)
@@ -281,15 +280,15 @@ GEM
281
280
  rubysl-weakref (2.0.0)
282
281
  rubysl-webrick (2.0.0)
283
282
  rubysl-xmlrpc (2.0.0)
284
- rubysl-yaml (2.0.4)
283
+ rubysl-yaml (2.1.0)
285
284
  rubysl-zlib (2.0.1)
286
- safe_yaml (1.0.3)
287
- simplecov (0.8.2)
285
+ safe_yaml (1.0.4)
286
+ simplecov (0.9.2)
288
287
  docile (~> 1.1.0)
289
- multi_json
290
- simplecov-html (~> 0.8.0)
291
- simplecov-html (0.8.0)
292
- slop (3.5.0)
288
+ multi_json (~> 1.0)
289
+ simplecov-html (~> 0.9.0)
290
+ simplecov-html (0.9.0)
291
+ slop (3.6.0)
293
292
  spoon (0.0.4)
294
293
  ffi
295
294
  sys-uname (0.9.2)
@@ -297,24 +296,24 @@ GEM
297
296
  term-ansicolor (1.3.0)
298
297
  tins (~> 1.0)
299
298
  thor (0.19.1)
300
- tins (1.3.0)
301
- travis (1.6.11)
299
+ tins (1.3.4)
300
+ travis (1.7.5)
302
301
  addressable (~> 2.3)
303
302
  backports
304
303
  faraday (~> 0.9)
305
- faraday_middleware (~> 0.9)
304
+ faraday_middleware (~> 0.9, >= 0.9.1)
306
305
  gh (~> 0.13)
307
306
  highline (~> 1.6)
308
307
  launchy (~> 2.1)
309
- pry (~> 0.9)
308
+ pry (~> 0.9, < 0.10)
310
309
  pusher-client (~> 0.4)
311
310
  typhoeus (~> 0.6, >= 0.6.8)
312
- typhoeus (0.6.8)
313
- ethon (>= 0.7.0)
314
- webmock (1.18.0)
311
+ typhoeus (0.7.1)
312
+ ethon (>= 0.7.1)
313
+ webmock (1.20.4)
315
314
  addressable (>= 2.3.6)
316
315
  crack (>= 0.3.2)
317
- websocket (1.1.4)
316
+ websocket (1.2.1)
318
317
 
319
318
  PLATFORMS
320
319
  java
@@ -325,14 +324,17 @@ DEPENDENCIES
325
324
  autotest-fsevent
326
325
  autotest-growl
327
326
  coveralls
327
+ highline (< 1.7.0)
328
328
  httpclient (~> 2.4)
329
329
  json (>= 1.5.1)
330
330
  mime-types (< 2.0)
331
331
  rake
332
332
  rdoc
333
333
  redgreen
334
+ rest-client (= 1.6.8)
334
335
  rspec (>= 2.5.0)
335
336
  rubysl (~> 2.0)
337
+ safe_yaml (~> 1.0.4)
336
338
  simplecov
337
339
  travis
338
340
  webmock
data/README.md CHANGED
@@ -1,36 +1,40 @@
1
- Algolia Search API Client for Ruby
2
- ==================
1
+ # Algolia Search API Client for Ruby
3
2
 
4
3
 
5
4
 
6
- [Algolia Search](http://www.algolia.com) is a search API that provides hosted full-text, numerical and faceted search.
7
- Algolias Search API makes it easy to deliver a great search experience in your apps & websites providing:
5
+ [Algolia Search](http://www.algolia.com) is a hosted full-text, numerical, and faceted search engine capable of delivering realtime results from the first keystroke.
6
+ Algolia's Search API makes it easy to deliver a great search experience in your websites and mobile applications by providing:
8
7
 
9
- * REST and JSON-based API
10
- * search among infinite attributes from a single searchbox
11
- * instant-search after each keystroke
12
- * relevance & popularity combination
13
- * typo-tolerance in any language
14
- * faceting
8
+ * REST and JSON based API
9
+ * Search against infinite attributes from a single search box
10
+ * Instant search as you type experience
11
+ * Relevance and popularity ranking
12
+ * Global language support
13
+ * Typo tolerance in any language
14
+ * Smart highlighting
15
+ * Facet as you type
16
+ * Geo awareness
15
17
  * 99.99% SLA
16
- * first-class data security
18
+ * First class data security
17
19
 
18
- This Ruby client let you easily use the Algolia Search API from your backend. It wraps [Algolia's REST API](http://www.algolia.com/doc/rest_api).
20
+ Our Ruby client lets you easily use the [Algolia Search API](http://www.algolia.com) from your backend. It wraps the [Algolia Search REST API](http://www.algolia.com/doc/rest_api).
19
21
 
20
- [![Build Status](https://travis-ci.org/algolia/algoliasearch-client-ruby.png?branch=master)](https://travis-ci.org/algolia/algoliasearch-client-ruby) [![Gem Version](https://badge.fury.io/rb/algoliasearch.png)](http://badge.fury.io/rb/algoliasearch) [![Code Climate](https://codeclimate.com/github/algolia/algoliasearch-client-ruby.png)](https://codeclimate.com/github/algolia/algoliasearch-client-ruby) [![Coverage Status](https://coveralls.io/repos/algolia/algoliasearch-client-ruby/badge.png)](https://coveralls.io/r/algolia/algoliasearch-client-ruby)
22
+
23
+ [![Build Status](https://travis-ci.org/algolia/algoliasearch-client-ruby.svg?branch=master)](https://travis-ci.org/algolia/algoliasearch-client-ruby) [![Gem Version](https://badge.fury.io/rb/algoliasearch.svg)](http://badge.fury.io/rb/algoliasearch) [![Code Climate](https://codeclimate.com/github/algolia/algoliasearch-client-ruby.svg)](https://codeclimate.com/github/algolia/algoliasearch-client-ruby) [![Coverage Status](https://coveralls.io/repos/algolia/algoliasearch-client-ruby/badge.png)](https://coveralls.io/r/algolia/algoliasearch-client-ruby)
21
24
 
22
25
 
23
26
 
24
- Table of Content
25
- ================
26
- **Get started**
27
+
28
+ Table of Contents
29
+ =================
30
+ **Getting Started**
27
31
 
28
32
  1. [Setup](#setup)
29
33
  1. [Quick Start](#quick-start)
30
34
  1. [Online documentation](#documentation)
31
35
  1. [Tutorials](#tutorials)
32
36
 
33
- **Commands reference**
37
+ **Commands Reference**
34
38
 
35
39
  1. [Add a new object](#add-a-new-object-in-the-index)
36
40
  1. [Update an object](#update-an-existing-object-in-the-index)
@@ -71,6 +75,12 @@ Algolia.init :application_id => "YourApplicationID",
71
75
  :api_key => "YourAPIKey"
72
76
  ```
73
77
 
78
+ ### Ruby on Rails
79
+
80
+ If you're a Ruby on Rails user; you're probably looking for the [algoliasearch-rails](https://github.com/algolia/algoliasearch-rails) gem.
81
+
82
+
83
+
74
84
 
75
85
 
76
86
 
@@ -80,16 +90,16 @@ Algolia.init :application_id => "YourApplicationID",
80
90
  Quick Start
81
91
  -------------
82
92
 
83
- This quick start is a 30 seconds tutorial where you can discover how to index and search objects.
93
+ In 30 seconds, this quick start tutorial will show you how to index and search objects.
84
94
 
85
- Without any prior-configuration, you can index [500 contacts](https://github.com/algolia/algoliasearch-client-ruby/blob/master/contacts.json) in the ```contacts``` index with the following code:
95
+ Without any prior configuration, you can start indexing [500 contacts](https://github.com/algolia/algoliasearch-client-csharp/blob/master/contacts.json) in the ```contacts``` index using the following code:
86
96
  ```ruby
87
97
  index = Algolia::Index.new("contacts")
88
98
  batch = JSON.parse(File.read("contacts.json"))
89
99
  index.add_objects(batch)
90
100
  ```
91
101
 
92
- You can then start to search for a contact firstname, lastname, company, ... (even with typos):
102
+ You can now search for contacts using firstname, lastname, company, etc. (even with typos):
93
103
  ```ruby
94
104
  # search by firstname
95
105
  puts index.search('jimmie').to_json
@@ -101,7 +111,7 @@ puts index.search('california paint').to_json
101
111
  puts index.search('jimmie paint').to_json
102
112
  ```
103
113
 
104
- Settings can be customized to tune the search behavior. For example you can add a custom sort by number of followers to the already good out-of-the-box relevance:
114
+ Settings can be customized to tune the search behavior. For example, you can add a custom sort by number of followers to the already great built-in relevance:
105
115
  ```ruby
106
116
  index.set_settings({"customRanking" => ["desc(followers)"]})
107
117
  ```
@@ -120,8 +130,8 @@ puts index.search('jim').to_json
120
130
 
121
131
 
122
132
  **Notes:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-js) to perform queries. It brings two benefits:
123
- * your users get a better response time by avoiding to go through your servers,
124
- * it will offload your servers of unnecessary tasks.
133
+ * Your users get a better response time by not going through your servers
134
+ * It will offload unnecessary tasks from your servers.
125
135
 
126
136
  ```html
127
137
  <script type="text/javascript" src="//path/to/algoliasearch.min.js"></script>
@@ -169,32 +179,32 @@ Check our [online documentation](http://www.algolia.com/doc/guides/ruby):
169
179
  Tutorials
170
180
  ================
171
181
 
172
- Check our [tutorials](http://www.algolia.com/doc/tutorials):
173
- * [Searchbar with auto-completion](http://www.algolia.com/doc/tutorials/auto-complete)
174
- * [Searchbar with multi-categories auto-completion](http://www.algolia.com/doc/tutorials/multi-auto-complete)
175
- * [Instant-search](http://www.algolia.com/doc/tutorials/instant-search)
182
+ Check out our [tutorials](http://www.algolia.com/doc/tutorials):
183
+ * [Search bar with autocomplete menu](http://www.algolia.com/doc/tutorials/auto-complete)
184
+ * [Search bar with multi category autocomplete menu](http://www.algolia.com/doc/tutorials/multi-auto-complete)
185
+ * [Instant search result pages](http://www.algolia.com/doc/tutorials/instant-search)
176
186
 
177
187
 
178
188
 
179
- Commands reference
189
+ Commands Reference
180
190
  ==================
181
191
 
182
192
 
183
193
 
184
194
 
185
195
 
186
- Add a new object in the Index
196
+ Add a new object to the Index
187
197
  -------------
188
198
 
189
- Each entry in an index has a unique identifier called `objectID`. You have two ways to add en entry in the index:
199
+ Each entry in an index has a unique identifier called `objectID`. There are two ways to add en entry to the index:
190
200
 
191
- 1. Using automatic `objectID` assignement, you will be able to retrieve it in the answer.
192
- 2. Passing your own `objectID`
201
+ 1. Using automatic `objectID` assignment. You will be able to access it in the answer.
202
+ 2. Supplying your own `objectID`.
193
203
 
194
- You don't need to explicitely create an index, it will be automatically created the first time you add an object.
195
- Objects are schema less, you don't need any configuration to start indexing. The settings section provide details about advanced settings.
204
+ You don't need to explicitly create an index, it will be automatically created the first time you add an object.
205
+ Objects are schema less so you don't need any configuration to start indexing. If you wish to configure things, the settings section provides details about advanced settings.
196
206
 
197
- Example with automatic `objectID` assignement:
207
+ Example with automatic `objectID` assignment:
198
208
 
199
209
  ```ruby
200
210
  res = index.add_object({"firstname" => "Jimmie",
@@ -202,7 +212,7 @@ res = index.add_object({"firstname" => "Jimmie",
202
212
  puts "ObjectID=" + res["objectID"]
203
213
  ```
204
214
 
205
- Example with manual `objectID` assignement:
215
+ Example with manual `objectID` assignment:
206
216
 
207
217
  ```ruby
208
218
  res = index.add_object({"firstname" => "Jimmie",
@@ -213,12 +223,13 @@ puts "ObjectID=" + res["objectID"]
213
223
  Update an existing object in the Index
214
224
  -------------
215
225
 
216
- You have two options to update an existing object:
226
+ You have three options when updating an existing object:
217
227
 
218
228
  1. Replace all its attributes.
219
229
  2. Replace only some attributes.
230
+ 3. Apply an operation to some attributes.
220
231
 
221
- Example to replace all the content of an existing object:
232
+ Example on how to replace all attributes of an existing object:
222
233
 
223
234
  ```ruby
224
235
  index.save_object({"firstname" => "Jimmie",
@@ -227,6 +238,15 @@ index.save_object({"firstname" => "Jimmie",
227
238
  "objectID" => "myID"})
228
239
  ```
229
240
 
241
+ You have many ways to update an object's attributes:
242
+
243
+ 1. Set the attribute value
244
+ 2. Add an element to an array
245
+ 3. Remove an element from an array
246
+ 4. Add an element to an array if it doesn't exist
247
+ 5. Increment an attribute
248
+ 6. Decrement an attribute
249
+
230
250
  Example to update only the city attribute of an existing object:
231
251
 
232
252
  ```ruby
@@ -234,92 +254,133 @@ index.partial_update_object({"city" => "San Francisco",
234
254
  "objectID" => "myID"})
235
255
  ```
236
256
 
257
+ Example to add a tag:
258
+
259
+ ```ruby
260
+ index.partial_update_object({"_tags" => {"value" => "MyTag", "_operation": "Add"},
261
+ "objectID" => "myID"})
262
+ ```
263
+
264
+ Example to remove a tag:
265
+
266
+ ```ruby
267
+ index.partial_update_object({"_tags" => {"value" => "MyTag", "_operation": "Remove"},
268
+ "objectID" => "myID"})
269
+ ```
270
+
271
+ Example to add a tag if it doesn't exist:
272
+
273
+ ```ruby
274
+ index.partial_update_object({"_tags" => {"value" => "MyTag", "_operation": "AddUnique"},
275
+ "objectID" => "myID"})
276
+ ```
277
+
278
+ Example to increment a numeric value:
279
+
280
+ ```ruby
281
+ index.partial_update_object({"price" => {"value" => 42, "_operation": "Increment"},
282
+ "objectID" => "myID"})
283
+ ```
284
+
285
+ Example to decrement a numeric value:
286
+
287
+ ```ruby
288
+ index.partial_update_object({"price" => {"value" => 42, "_operation": "Decrement"},
289
+ "objectID" => "myID"})
290
+ ```
291
+
237
292
 
238
293
 
239
294
  Search
240
295
  -------------
241
296
 
242
- **Opening note:** If you are building a web application, you may be more interested in using our [javascript client](https://github.com/algolia/algoliasearch-client-js) to send queries. It brings two benefits:
243
- * your users get a better response time by avoiding to go through your servers,
244
- * and it will offload your servers of unnecessary tasks.
297
+ **Notes:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-js) to perform queries. It brings two benefits:
298
+ * Your users get a better response time by not going through your servers
299
+ * It will offload unnecessary tasks from your servers.
245
300
 
246
301
 
247
- To perform a search, you just need to initialize the index and perform a call to the search function.
302
+ To perform a search, you only need to initialize the index and perform a call to the search function.
248
303
 
249
304
  You can use the following optional arguments:
250
305
 
251
- ### Query parameters
252
-
253
- #### Full Text Search parameters
254
-
255
- * **query**: (string) The instant-search query string, all words of the query are interpreted as prefixes (for example "John Mc" will match "John Mccamey" and "Johnathan Mccamey"). If no query parameter is set, retrieves all objects.
256
- * **queryType**: select how the query words are interpreted, it can be one of the following value:
257
- * **prefixAll**: all query words are interpreted as prefixes,
258
- * **prefixLast**: only the last word is interpreted as a prefix (default behavior),
259
- * **prefixNone**: no query word is interpreted as a prefix. This option is not recommended.
260
- * **removeWordsIfNoResults**: This option to select a strategy to avoid having an empty result page. There is three different option:
261
- * **lastWords**: when a query does not return any result, the last word will be added as optional (the process is repeated with n-1 word, n-2 word, ... until there is results),
262
- * **firstWords**: when a query does not return any result, the first word will be added as optional (the process is repeated with second word, third word, ... until there is results),
263
- * **none**: No specific processing is done when a query does not return any result (default behavior).
264
- * **typoTolerance**: if set to false, disable the typo-tolerance. Defaults to true.
265
- * **minWordSizefor1Typo**: the minimum number of characters in a query word to accept one typo in this word.<br/>Defaults to 4.
266
- * **minWordSizefor2Typos**: the minimum number of characters in a query word to accept two typos in this word.<br/>Defaults to 8.
267
- * **allowTyposOnNumericTokens**: if set to false, disable typo-tolerance on numeric tokens (numbers). Default to true.
268
- * **ignorePlural**: If set to true, plural won't be considered as a typo (for example car/cars will be considered as equals). Default to false.
269
- * **restrictSearchableAttributes** List of attributes you want to use for textual search (must be a subset of the `attributesToIndex` index setting). Attributes are separated with a comma (for example `"name,address"`), you can also use a JSON string array encoding (for example encodeURIComponent("[\"name\",\"address\"]")). By default, all attributes specified in `attributesToIndex` settings are used to search.
270
- * **advancedSyntax**: Enable the advanced query syntax. Defaults to 0 (false).
271
- * **Phrase query**: a phrase query defines a particular sequence of terms. A phrase query is build by Algolia's query parser for words surrounded by `"`. For example, `"search engine"` will retrieve records having `search` next to `engine` only. Typo-tolerance is _disabled_ on phrase queries.
272
- * **Prohibit operator**: The prohibit operator excludes records that contain the term after the `-` symbol. For example `search -engine` will retrieve records containing `search` but not `engine`.
273
- * **analytics**: If set to false, this query will not be taken into account in analytics feature. Default to true.
274
- * **synonyms**: If set to false, this query will not use synonyms defined in configuration. Default to true.
275
- * **replaceSynonymsInHighlight**: If set to false, words matched via synonyms expansion will not be replaced by the matched synonym in highlight result. Default to true.
276
- * **optionalWords**: a string that contains the list of words that should be considered as optional when found in the query. The list of words is comma separated.
277
-
278
- #### Pagination parameters
279
-
280
- * **page**: (integer) Pagination parameter used to select the page to retrieve.<br/>Page is zero-based and defaults to 0. Thus, to retrieve the 10th page you need to set `page=9`
306
+ ### Query Parameters
307
+
308
+ #### Full Text Search Parameters
309
+
310
+ * **query**: (string) The instant search query string. All words of the query are interpreted as prefixes (for example "John Mc" will match "John Mccamey" and "Johnathan Mccamey"). If no query parameter is set all objects are retrieved.
311
+ * **queryType**: Selects how the query words are interpreted. It can be one of the following values:
312
+ * **prefixAll**: All query words are interpreted as prefixes.
313
+ * **prefixLast**: Only the last word is interpreted as a prefix (default behavior).
314
+ * **prefixNone**: No query word is interpreted as a prefix. This option is not recommended.
315
+ * **removeWordsIfNoResults**: This option is used to select a strategy in order to avoid having an empty result page. There are three different options:
316
+ * **lastWords**: When a query does not return any results, the last word will be added as optional. The process is repeated with n-1 word, n-2 word, ... until there are results.
317
+ * **firstWords**: When a query does not return any results, the first word will be added as optional. The process is repeated with second word, third word, ... until there are results.
318
+ * **allOptional**: When a query does not return any results, a second trial will be made with all words as optional. This is equivalent to transforming the AND operand between query terms to an OR operand.
319
+ * **none**: No specific processing is done when a query does not return any results (default behavior).
320
+ * **minWordSizefor1Typo**: The minimum number of characters in a query word to accept one typo in this word.<br/>Defaults to 4.
321
+ * **minWordSizefor2Typos**: The minimum number of characters in a query word to accept two typos in this word.<br/>Defaults to 8.
322
+ * **allowTyposOnNumericTokens**: If set to false, it disables typo tolerance on numeric tokens (numbers). Defaults to false.
323
+ * **typoTolerance**: This option allows you to control the number of typos in the result set:
324
+ * **true**: The typo tolerance is enabled and all matching hits are retrieved (default behavior).
325
+ * **false**: The typo tolerance is disabled. For example, if one result matches without typos, then all results with typos will be hidden.
326
+ * **min**: Only keep results with the minimum number of typos.
327
+ * **strict**: Hits matching with 2 typos are not retrieved if there are some matching without typos. This option is useful if you want to avoid false positives as much as possible.
328
+ * **allowTyposOnNumericTokens**: If set to false, disables typo tolerance on numeric tokens (numbers). Defaults to true.
329
+ * **ignorePlural**: If set to true, plural won't be considered as a typo. For example, car and cars will be considered as equals. Defaults to false.
330
+ * **restrictSearchableAttributes** List of attributes you want to use for textual search (must be a subset of the `attributesToIndex` index setting). Attributes are separated with a comma such as `"name,address"`. You can also use JSON string array encoding such as `encodeURIComponent("[\"name\",\"address\"]")`. By default, all attributes specified in `attributesToIndex` settings are used to search.
331
+ * **advancedSyntax**: Enables the advanced query syntax. Defaults to 0 (false).
332
+ * **Phrase query**: A phrase query defines a particular sequence of terms. A phrase query is built by Algolia's query parser for words surrounded by `"`. For example, `"search engine"` will retrieve records having `search` next to `engine` only. Typo tolerance is _disabled_ on phrase queries.
333
+ * **Prohibit operator**: The prohibit operator excludes records that contain the term after the `-` symbol. For example, `search -engine` will retrieve records containing `search` but not `engine`.
334
+ * **analytics**: If set to false, this query will not be taken into account in the analytics feature. Defaults to true.
335
+ * **synonyms**: If set to false, this query will not use synonyms defined in the configuration. Defaults to true.
336
+ * **replaceSynonymsInHighlight**: If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlight results. Defaults to true.
337
+ * **optionalWords**: A string that contains the comma separated list of words that should be considered as optional when found in the query.
338
+
339
+ #### Pagination Parameters
340
+
341
+ * **page**: (integer) Pagination parameter used to select the page to retrieve.<br/>Page is zero based and defaults to 0. Thus, to retrieve the 10th page you need to set `page=9`.
281
342
  * **hitsPerPage**: (integer) Pagination parameter used to select the number of hits per page. Defaults to 20.
282
343
 
283
- #### Geo-search parameters
344
+ #### Geo-search Parameters
284
345
 
285
- * **aroundLatLng**: search for entries around a given latitude/longitude (specified as two floats separated by a comma).<br/>For example `aroundLatLng=47.316669,5.016670`).<br/>You can specify the maximum distance in meters with the **aroundRadius** parameter (in meters) and the precision for ranking with **aroundPrecision** (for example if you set aroundPrecision=100, two objects that are distant of less than 100m will be considered as identical for "geo" ranking parameter).<br/>At indexing, you should specify geoloc of an object with the `_geoloc` attribute (in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`)
346
+ * **aroundLatLng**: Search for entries around a given latitude/longitude (specified as two floats separated by a comma).<br/>For example, `aroundLatLng=47.316669,5.016670`.<br/>You can specify the maximum distance in meters with the **aroundRadius** parameter and the precision for ranking with **aroundPrecision**. For example, if you set aroundPrecision=100, two objects that are a distance of less than 100 meters will be considered as identical for the "geo" ranking parameter).<br/>At indexing, you should specify the geo location of an object with the `_geoloc` attribute in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`.
286
347
 
287
- * **aroundLatLngViaIP**: search for entries around a given latitude/longitude (automatically computed from user IP address).<br/>For example `aroundLatLng=47.316669,5.016670`).<br/>You can specify the maximum distance in meters with the **aroundRadius** parameter (in meters) and the precision for ranking with **aroundPrecision** (for example if you set aroundPrecision=100, two objects that are distant of less than 100m will be considered as identical for "geo" ranking parameter).<br/>At indexing, you should specify geoloc of an object with the `_geoloc` attribute (in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`)
348
+ * **aroundLatLngViaIP**: Search for entries around a given latitude/longitude automatically computed from user IP address.<br/>For example, `aroundLatLng=47.316669,5.016670`.<br/>You can specify the maximum distance in meters with the **aroundRadius** parameter and the precision for ranking with **aroundPrecision**. For example, if you set aroundPrecision=100, two objects that are a distance of less than 100 meters will be considered as identical for the "geo" ranking parameter.<br/>At indexing, you should specify the geo location of an object with the `_geoloc` attribute in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`.
288
349
 
289
350
 
290
- * **insideBoundingBox**: search entries inside a given area defined by the two extreme points of a rectangle (defined by 4 floats: p1Lat,p1Lng,p2Lat,p2Lng).<br/>For example `insideBoundingBox=47.3165,4.9665,47.3424,5.0201`).<br/>At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`)
351
+ * **insideBoundingBox**: Search entries inside a given area defined by the two extreme points of a rectangle (defined by 4 floats: p1Lat,p1Lng,p2Lat,p2Lng).<br/>For example, `insideBoundingBox=47.3165,4.9665,47.3424,5.0201`).<br/>At indexing, you should specify the geo location of an object with the _geoloc attribute in the form `{"_geoloc":{"lat":48.853409, "lng":2.348800}}`.
291
352
 
292
- #### Parameters to control results content
353
+ #### Parameters to Control Results Content
293
354
 
294
- * **attributesToRetrieve**: a string that contains the list of object attributes you want to retrieve (let you minimize the answer size).<br/> Attributes are separated with a comma (for example `"name,address"`), you can also use a string array encoding (for example `["name","address"]` ). By default, all attributes are retrieved. You can also use `*` to retrieve all values when an **attributesToRetrieve** setting is specified for your index.
295
- * **attributesToHighlight**: a string that contains the list of attributes you want to highlight according to the query. Attributes are separated by a comma. You can also use a string array encoding (for example `["name","address"]`). If an attribute has no match for the query, the raw value is returned. By default all indexed text attributes are highlighted. You can use `*` if you want to highlight all textual attributes. Numerical attributes are not highlighted. A matchLevel is returned for each highlighted attribute and can contain:
296
- * **full**: if all the query terms were found in the attribute,
297
- * **partial**: if only some of the query terms were found,
298
- * **none**: if none of the query terms were found.
299
- * **attributesToSnippet**: a string that contains the list of attributes to snippet alongside the number of words to return (syntax is `attributeName:nbWords`). Attributes are separated by a comma (Example: `attributesToSnippet=name:10,content:10`). <br/>You can also use a string array encoding (Example: `attributesToSnippet: ["name:10","content:10"]`). By default no snippet is computed.
300
- * **getRankingInfo**: if set to 1, the result hits will contain ranking information in **_rankingInfo** attribute.
355
+ * **attributesToRetrieve**: A string that contains the list of object attributes you want to retrieve in order to minimize the answer size.<br/> Attributes are separated with a comma (for example `"name,address"`). You can also use a string array encoding (for example `["name","address"]` ). By default, all attributes are retrieved. You can also use `*` to retrieve all values when an **attributesToRetrieve** setting is specified for your index.
356
+ * **attributesToHighlight**: A string that contains the list of attributes you want to highlight according to the query. Attributes are separated by commas. You can also use a string array encoding (for example `["name","address"]`). If an attribute has no match for the query, the raw value is returned. By default all indexed text attributes are highlighted. You can use `*` if you want to highlight all textual attributes. Numerical attributes are not highlighted. A matchLevel is returned for each highlighted attribute and can contain:
357
+ * **full**: If all the query terms were found in the attribute.
358
+ * **partial**: If only some of the query terms were found.
359
+ * **none**: If none of the query terms were found.
360
+ * **attributesToSnippet**: A string that contains the list of attributes to snippet alongside the number of words to return (syntax is `attributeName:nbWords`). Attributes are separated by commas (Example: `attributesToSnippet=name:10,content:10`). <br/>You can also use a string array encoding (Example: `attributesToSnippet: ["name:10","content:10"]`). By default, no snippet is computed.
361
+ * **getRankingInfo**: If set to 1, the result hits will contain ranking information in the **_rankingInfo** attribute.
301
362
 
302
363
 
303
- #### Numeric search parameters
304
- * **numericFilters**: a string that contains the list of numeric filters you want to apply separated by a comma. The syntax of one filter is `attributeName` followed by `operand` followed by `value`. Supported operands are `<`, `<=`, `=`, `>` and `>=`.
364
+ #### Numeric Search Parameters
365
+ * **numericFilters**: A string that contains the comma separated list of numeric filters you want to apply. The filter syntax is `attributeName` followed by `operand` followed by `value`. Supported operands are `<`, `<=`, `=`, `>` and `>=`.
305
366
 
306
- You can easily perform range queries via the `:` operator (equivalent to combining a `>=` and `<=` operand), for example `numericFilters=price:10 to 1000`.
367
+ You can easily perform range queries via the `:` operator. This is equivalent to combining a `>=` and `<=` operand. For example, `numericFilters=price:10 to 1000`.
307
368
 
308
- You can also mix OR and AND operators. The OR operator is defined with a parenthesis syntax. For example `(code=1 AND (price:[0-100] OR price:[1000-2000]))` translates in `encodeURIComponent("code=1,(price:0 to 10,price:1000 to 2000)")`.
369
+ You can also mix OR and AND operators. The OR operator is defined with a parenthesis syntax. For example, `(code=1 AND (price:[0-100] OR price:[1000-2000]))` translates to `encodeURIComponent("code=1,(price:0 to 10,price:1000 to 2000)")`.
309
370
 
310
371
  You can also use a string array encoding (for example `numericFilters: ["price>100","price<1000"]`).
311
372
 
312
- #### Category search parameters
313
- * **tagFilters**: filter the query by a set of tags. You can AND tags by separating them by commas. To OR tags, you must add parentheses. For example, `tags=tag1,(tag2,tag3)` means *tag1 AND (tag2 OR tag3)*. You can also use a string array encoding, for example `tagFilters: ["tag1",["tag2","tag3"]]` means *tag1 AND (tag2 OR tag3)*.<br/>At indexing, tags should be added in the **_tags** attribute of objects (for example `{"_tags":["tag1","tag2"]}`).
373
+ #### Category Search Parameters
374
+ * **tagFilters**: Filter the query by a set of tags. You can AND tags by separating them with commas. To OR tags, you must add parentheses. For example, `tags=tag1,(tag2,tag3)` means *tag1 AND (tag2 OR tag3)*. You can also use a string array encoding. For example, `tagFilters: ["tag1",["tag2","tag3"]]` means *tag1 AND (tag2 OR tag3)*.<br/>At indexing, tags should be added in the **_tags** attribute of objects. For example `{"_tags":["tag1","tag2"]}`.
314
375
 
315
- #### Faceting parameters
316
- * **facetFilters**: filter the query by a list of facets. Facets are separated by commas and each facet is encoded as `attributeName:value`. To OR facets, you must add parentheses. For example: `facetFilters=(category:Book,category:Movie),author:John%20Doe`. You can also use a string array encoding (for example `[["category:Book","category:Movie"],"author:John%20Doe"]`).
317
- * **facets**: List of object attributes that you want to use for faceting. <br/>Attributes are separated with a comma (for example `"category,author"` ). You can also use a JSON string array encoding (for example `["category","author"]` ). Only attributes that have been added in **attributesForFaceting** index setting can be used in this parameter. You can also use `*` to perform faceting on all attributes specified in **attributesForFaceting**.
318
- * **maxValuesPerFacet**: Limit the number of facet values returned for each facet. For example: `maxValuesPerFacet=10` will retrieve max 10 values per facet.
376
+ #### Faceting Parameters
377
+ * **facetFilters**: Filter the query with a list of facets. Facets are separated by commas and is encoded as `attributeName:value`. To OR facets, you must add parentheses. For example: `facetFilters=(category:Book,category:Movie),author:John%20Doe`. You can also use a string array encoding. For example, `[["category:Book","category:Movie"],"author:John%20Doe"]`.
378
+ * **facets**: List of object attributes that you want to use for faceting. <br/>Attributes are separated with a comma. For example, `"category,author"`. You can also use JSON string array encoding. For example, `["category","author"]`. Only the attributes that have been added in **attributesForFaceting** index setting can be used in this parameter. You can also use `*` to perform faceting on all attributes specified in **attributesForFaceting**.
379
+ * **maxValuesPerFacet**: Limit the number of facet values returned for each facet. For example, `maxValuesPerFacet=10` will retrieve a maximum of 10 values per facet.
319
380
 
320
- #### Distinct parameter
321
- * **distinct**: If set to 1, enable the distinct feature (disabled by default) if the `attributeForDistinct` index setting is set. This feature is similar to the SQL "distinct" keyword: when enabled in a query with the `distinct=1` parameter, all hits containing a duplicate value for the attributeForDistinct attribute are removed from results. For example, if the chosen attribute is `show_name` and several hits have the same value for `show_name`, then only the best one is kept and others are removed.
322
- **Note**: This feature is disabled if the query string is empty and there isn't any `tagFilters`, nor any `facetFilters`, nor any `numericFilters` parameters.
381
+ #### Distinct Parameter
382
+ * **distinct**: If set to 1, enables the distinct feature, disabled by default, if the `attributeForDistinct` index setting is set. This feature is similar to the SQL "distinct" keyword. When enabled in a query with the `distinct=1` parameter, all hits containing a duplicate value for the attributeForDistinct attribute are removed from results. For example, if the chosen attribute is `show_name` and several hits have the same value for `show_name`, then only the best one is kept and the others are removed.
383
+ **Note**: This feature is disabled if the query string is empty and there aren't any `tagFilters`, `facetFilters`, nor `numericFilters` parameters.
323
384
 
324
385
  ```ruby
325
386
  index = Algolia::Index.new("contacts")
@@ -363,7 +424,7 @@ The server response will look like:
363
424
  ```
364
425
 
365
426
 
366
- Multi-queries
427
+ Multiple queries
367
428
  --------------
368
429
 
369
430
  You can send multiple queries with a single API call using a batch of queries:
@@ -381,13 +442,10 @@ puts res["results"]
381
442
 
382
443
 
383
444
 
384
-
385
-
386
-
387
445
  Get an object
388
446
  -------------
389
447
 
390
- You can easily retrieve an object using its `objectID` and optionnaly a list of attributes you want to retrieve (using comma as separator):
448
+ You can easily retrieve an object using its `objectID` and optionally specify a comma separated list of attributes you want:
391
449
 
392
450
  ```ruby
393
451
  # Retrieves all attributes
@@ -404,6 +462,10 @@ You can also retrieve a set of objects:
404
462
  res = index.get_objects(["myID", "myID2"])
405
463
  ```
406
464
 
465
+
466
+
467
+
468
+
407
469
  Delete an object
408
470
  -------------
409
471
 
@@ -417,7 +479,7 @@ index.delete_object("myID")
417
479
  Delete by query
418
480
  -------------
419
481
 
420
- You can delete all objects matching a single query with the following code. Internally, the API client performs the query, delete all matching hits, wait until the deletions have been applied and so on.
482
+ You can delete all objects matching a single query with the following code. Internally, the API client performs the query, deletes all matching hits, and waits until the deletions have been applied.
421
483
 
422
484
  ```ruby
423
485
  params = {}
@@ -428,62 +490,62 @@ index.delete_by_query("John", params)
428
490
  Index Settings
429
491
  -------------
430
492
 
431
- You can retrieve all settings using the `get_settings` function. The result will contains the following attributes:
493
+ You can retrieve all settings using the `get_settings` function. The result will contain the following attributes:
432
494
 
433
495
 
434
496
  #### Indexing parameters
435
- * **attributesToIndex**: (array of strings) the list of fields you want to index.<br/>If set to null, all textual and numerical attributes of your objects are indexed, but you should update it to get optimal results.<br/>This parameter has two important uses:
436
- * *Limit the attributes to index*.<br/>For example if you store a binary image in base64, you want to store it and be able to retrieve it but you don't want to search in the base64 string.
437
- * *Control part of the ranking*.<br/>(see the ranking parameter for full explanation) Matches in attributes at the beginning of the list will be considered more important than matches in attributes further down the list. In one attribute, matching text at the beginning of the attribute will be considered more important than text after, you can disable this behavior if you add your attribute inside `unordered(AttributeName)`, for example `attributesToIndex: ["title", "unordered(text)"]`.
497
+ * **attributesToIndex**: (array of strings) The list of fields you want to index.<br/>If set to null, all textual and numerical attributes of your objects are indexed. Be sure to update it to get optimal results.<br/>This parameter has two important uses:
498
+ * *Limit the attributes to index*.<br/>For example, if you store a binary image in base64, you want to store it and be able to retrieve it, but you don't want to search in the base64 string.
499
+ * *Control part of the ranking*.<br/>(see the ranking parameter for full explanation) Matches in attributes at the beginning of the list will be considered more important than matches in attributes further down the list. In one attribute, matching text at the beginning of the attribute will be considered more important than text after. You can disable this behavior if you add your attribute inside `unordered(AttributeName)`. For example, `attributesToIndex: ["title", "unordered(text)"]`.
438
500
  **Notes**: All numerical attributes are automatically indexed as numerical filters. If you don't need filtering on some of your numerical attributes, please consider sending them as strings to speed up the indexing.<br/>
439
- You can decide to have the same priority for two attributes by passing them in the same string using comma as separator. For example `title` and `alternative_title` have the same priority in this example, which is different than text priority: `attributesToIndex:["title,alternative_title", "text"]`
501
+ You can decide to have the same priority for two attributes by passing them in the same string using a comma as a separator. For example `title` and `alternative_title` have the same priority in this example, which is different than text priority: `attributesToIndex:["title,alternative_title", "text"]`.
440
502
  * **attributesForFaceting**: (array of strings) The list of fields you want to use for faceting. All strings in the attribute selected for faceting are extracted and added as a facet. If set to null, no attribute is used for faceting.
441
- * **attributeForDistinct**: The attribute name used for the `Distinct` feature. This feature is similar to the SQL "distinct" keyword: when enabled in query with the `distinct=1` parameter, all hits containing a duplicate value for this attribute are removed from results. For example, if the chosen attribute is `show_name` and several hits have the same value for `show_name`, then only the best one is kept and others are removed. **Note**: This feature is disabled if the query string is empty and there isn't any `tagFilters`, nor any `facetFilters`, nor any `numericFilters` parameters.
442
- * **ranking**: (array of strings) controls the way results are sorted.<br/>We have nine available criteria:
443
- * **typo**: sort according to number of typos,
444
- * **geo**: sort according to decreassing distance when performing a geo-location based search,
445
- * **words**: sort according to the number of query words matched by decreasing order. This parameter is useful when you use `optionalWords` query parameter to have results with the most matched words first.
446
- * **proximity**: sort according to the proximity of query words in hits,
447
- * **attribute**: sort according to the order of attributes defined by attributesToIndex,
503
+ * **attributeForDistinct**: The attribute name used for the `Distinct` feature. This feature is similar to the SQL "distinct" keyword. When enabled in queries with the `distinct=1` parameter, all hits containing a duplicate value for this attribute are removed from results. For example, if the chosen attribute is `show_name` and several hits have the same value for `show_name`, then only the best one is kept and others are removed. **Note**: This feature is disabled if the query string is empty and there aren't any `tagFilters`, `facetFilters`, nor `numericFilters` parameters.
504
+ * **ranking**: (array of strings) Controls the way results are sorted.<br/>We have nine available criteria:
505
+ * **typo**: Sort according to number of typos.
506
+ * **geo**: Sort according to decreasing distance when performing a geo location based search.
507
+ * **words**: Sort according to the number of query words matched by decreasing order. This parameter is useful when you use the `optionalWords` query parameter to have results with the most matched words first.
508
+ * **proximity**: Sort according to the proximity of the query words in hits.
509
+ * **attribute**: Sort according to the order of attributes defined by attributesToIndex.
448
510
  * **exact**:
449
- * if the user query contains one word: sort objects having an attribute that is exactly the query word before others. For example if you search for the "V" TV show, you want to find it with the "V" query and avoid to have all popular TV show starting by the v letter before it.
450
- * if the user query contains multiple words: sort according to the number of words that matched exactly (and not as a prefix).
451
- * **custom**: sort according to a user defined formula set in **customRanking** attribute.
452
- * **asc(attributeName)**: sort according to a numeric attribute by ascending order. **attributeName** can be the name of any numeric attribute of your records (integer, a double or boolean).
453
- * **desc(attributeName)**: sort according to a numeric attribute by descending order. **attributeName** can be the name of any numeric attribute of your records (integer, a double or boolean). <br/>The standard order is ["typo", "geo", "words", "proximity", "attribute", "exact", "custom"]
454
- * **customRanking**: (array of strings) lets you specify part of the ranking.<br/>The syntax of this condition is an array of strings containing attributes prefixed by asc (ascending order) or desc (descending order) operator.
455
- For example `"customRanking" => ["desc(population)", "asc(name)"]`
456
- * **queryType**: Select how the query words are interpreted, it can be one of the following value:
457
- * **prefixAll**: all query words are interpreted as prefixes,
458
- * **prefixLast**: only the last word is interpreted as a prefix (default behavior),
459
- * **prefixNone**: no query word is interpreted as a prefix. This option is not recommended.
460
- * **slaves**: The list of indices on which you want to replicate all write operations. In order to get response times in milliseconds, we pre-compute part of the ranking during indexing. If you want to use different ranking configurations depending of the use-case, you need to create one index per ranking configuration. This option enables you to perform write operations only on this index, and to automatically update slave indices with the same operations.
461
- * **unretrievableAttributes**: The list of attributes that cannot be retrieved at query time. This feature allow to have an attribute that is used for indexing and/or ranking but cannot be retrieved. Default to null.
462
- * **allowCompressionOfIntegerArray**: Allows compression of big integer arrays. We recommended to store the list of user ID or rights as an integer array and enable this setting. When enabled the integer array are reordered to reach a better compression ratio. Default to false.
511
+ * If the user query contains one word: sort objects having an attribute that is exactly the query word before others. For example, if you search for the TV show "V", you want to find it with the "V" query and avoid getting all popular TV shows starting by the letter V before it.
512
+ * If the user query contains multiple words: sort according to the number of words that matched exactly (not as a prefix).
513
+ * **custom**: Sort according to a user defined formula set in the **customRanking** attribute.
514
+ * **asc(attributeName)**: Sort according to a numeric attribute using ascending order. **attributeName** can be the name of any numeric attribute in your records (integer, double or boolean).
515
+ * **desc(attributeName)**: Sort according to a numeric attribute using descending order. **attributeName** can be the name of any numeric attribute in your records (integer, double or boolean). <br/>The standard order is ["typo", "geo", "words", "proximity", "attribute", "exact", "custom"].
516
+ * **customRanking**: (array of strings) Lets you specify part of the ranking.<br/>The syntax of this condition is an array of strings containing attributes prefixed by the asc (ascending order) or desc (descending order) operator. For example, `"customRanking" => ["desc(population)", "asc(name)"]`.
517
+ * **queryType**: Select how the query words are interpreted. It can be one of the following values:
518
+ * **prefixAll**: All query words are interpreted as prefixes.
519
+ * **prefixLast**: Only the last word is interpreted as a prefix (default behavior).
520
+ * **prefixNone**: No query word is interpreted as a prefix. This option is not recommended.
521
+ * **separatorsToIndex**: Specify the separators (punctuation characters) to index. By default, separators are not indexed. Use `+#` to be able to search Google+ or C#.
522
+ * **slaves**: The list of indices on which you want to replicate all write operations. In order to get response times in milliseconds, we pre-compute part of the ranking during indexing. If you want to use different ranking configurations depending of the use case, you need to create one index per ranking configuration. This option enables you to perform write operations only on this index and automatically update slave indices with the same operations.
523
+ * **unretrievableAttributes**: The list of attributes that cannot be retrieved at query time. This feature allows you to have attributes that are used for indexing and/or ranking but cannot be retrieved. Defaults to null.
524
+ * **allowCompressionOfIntegerArray**: Allows compression of big integer arrays. We recommended enabling this feature and then storing the list of user IDs or rights as an integer array. When enabled, the integer array is reordered to reach a better compression ratio. Defaults to false.
463
525
 
464
526
  #### Query expansion
465
- * **synonyms**: (array of array of words considered as equals). For example, you may want to retrieve your **black ipad** record when your users are searching for **dark ipad**, even if the **dark** word is not part of the record: so you need to configure **black** as a synonym of **dark**. For example `"synomyms": [ [ "black", "dark" ], [ "small", "little", "mini" ], ... ]`.
466
- * **placeholders**: (hash of array of words). This is an advanced use case to define a token substitutable by a list of words without having the original token searchable. It is defined by a hash associating placeholders to lists of substitutable words. For example `"placeholders": { "<streetnumber>": ["1", "2", "3", ..., "9999"]}` placeholder to be able to match all street numbers (we use the `< >` tag syntax to define placeholders in an attribute). For example:
467
- * Push a record with the placeholder: `{ "name" : "Apple Store", "address" : "&lt;streetnumber&gt; Opera street, Paris" }`
527
+ * **synonyms**: (array of array of words considered as equals). For example, you may want to retrieve the **black ipad** record when your users are searching for **dark ipad**, even if the word **dark** is not part of the record. To do this, you need to configure **black** as a synonym of **dark**. For example, `"synomyms": [ [ "black", "dark" ], [ "small", "little", "mini" ], ... ]`.
528
+ * **placeholders**: (hash of array of words). This is an advanced use case to define a token substitutable by a list of words without having the original token searchable. It is defined by a hash associating placeholders to lists of substitutable words. For example, `"placeholders": { "<streetnumber>": ["1", "2", "3", ..., "9999"]}` would allow it to be able to match all street numbers. We use the `< >` tag syntax to define placeholders in an attribute. For example:
529
+ * Push a record with the placeholder: `{ "name" : "Apple Store", "address" : "&lt;streetnumber&gt; Opera street, Paris" }`.
468
530
  * Configure the placeholder in your index settings: `"placeholders": { "<streetnumber>" : ["1", "2", "3", "4", "5", ... ], ... }`.
469
- * **disableTypoToleranceOn**: (string array). Specify a list of words on which the automatic typo tolerance will be disabled.
470
- * **altCorrections**: (object array). Specify alternative corrections that you want to consider. Each alternative correction is described by an object containing three attributes:
471
- * **word**: the word to correct
472
- * **correction**: the corrected word
473
- * **nbTypos** the number of typos (1 or 2) that will be considered for the ranking algorithm (1 typo is better than 2 typos)
474
-
475
- For example `"altCorrections": [ { "word" : "foot", "correction": "feet", "nbTypos": 1}, { "word": "feet", "correction": "foot", "nbTypos": 1}].`
476
-
477
- #### Default query parameters (can be overwrite by query)
478
- * **minWordSizefor1Typo**: (integer) the minimum number of characters to accept one typo (default = 4).
479
- * **minWordSizefor2Typos**: (integer) the minimum number of characters to accept two typos (default = 8).
480
- * **hitsPerPage**: (integer) the number of hits per page (default = 10).
481
- * **attributesToRetrieve**: (array of strings) default list of attributes to retrieve in objects. If set to null, all attributes are retrieved.
482
- * **attributesToHighlight**: (array of strings) default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
483
- * **attributesToSnippet**: (array of strings) default list of attributes to snippet alongside the number of words to return (syntax is 'attributeName:nbWords')<br/>By default no snippet is computed. If set to null, no snippet is computed.
484
- * **highlightPreTag**: (string) Specify the string that is inserted before the highlighted parts in the query result (default to "&lt;em&gt;").
485
- * **highlightPostTag**: (string) Specify the string that is inserted after the highlighted parts in the query result (default to "&lt;/em&gt;").
486
- * **optionalWords**: (array of strings) Specify a list of words that should be considered as optional when found in the query.
531
+ * **disableTypoToleranceOn**: (string array) Specify a list of words on which automatic typo tolerance will be disabled.
532
+ * **altCorrections**: (object array) Specify alternative corrections that you want to consider. Each alternative correction is described by an object containing three attributes:
533
+ * **word**: The word to correct.
534
+ * **correction**: The corrected word.
535
+ * **nbTypos** The number of typos (1 or 2) that will be considered for the ranking algorithm (1 typo is better than 2 typos).
536
+
537
+ For example `"altCorrections": [ { "word" : "foot", "correction": "feet", "nbTypos": 1 }, { "word": "feet", "correction": "foot", "nbTypos": 1 } ]`.
538
+
539
+ #### Default query parameters (can be overwritten by queries)
540
+ * **minWordSizefor1Typo**: (integer) The minimum number of characters needed to accept one typo (default = 4).
541
+ * **minWordSizefor2Typos**: (integer) The minimum number of characters needed to accept two typos (default = 8).
542
+ * **hitsPerPage**: (integer) The number of hits per page (default = 10).
543
+ * **attributesToRetrieve**: (array of strings) Default list of attributes to retrieve in objects. If set to null, all attributes are retrieved.
544
+ * **attributesToHighlight**: (array of strings) Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
545
+ * **attributesToSnippet**: (array of strings) Default list of attributes to snippet alongside the number of words to return (syntax is 'attributeName:nbWords').<br/>By default, no snippet is computed. If set to null, no snippet is computed.
546
+ * **highlightPreTag**: (string) Specify the string that is inserted before the highlighted parts in the query result (defaults to "&lt;em&gt;").
547
+ * **highlightPostTag**: (string) Specify the string that is inserted after the highlighted parts in the query result (defaults to "&lt;/em&gt;").
548
+ * **optionalWords**: (array of strings) Specify a list of words that should be considered optional when found in the query.
487
549
 
488
550
  You can easily retrieve settings or update them:
489
551
 
@@ -498,7 +560,7 @@ index.set_settings({"customRanking" => ["desc(followers)"]})
498
560
 
499
561
  List indices
500
562
  -------------
501
- You can list all your indices with their associated information (number of entries, disk size, etc.) with the `list_indexes` method:
563
+ You can list all your indices along with their associated information (number of entries, disk size, etc.) with the `list_indexes` method:
502
564
 
503
565
  ```ruby
504
566
  Algolia.list_indexes
@@ -515,7 +577,7 @@ index.delete_index
515
577
 
516
578
  Clear an index
517
579
  -------------
518
- You can delete the index content without removing settings and index specific API keys with the clearIndex command:
580
+ You can delete the index contents without removing settings and index specific API keys by using the clearIndex command:
519
581
 
520
582
  ```ruby
521
583
  index.clear_index
@@ -533,19 +595,19 @@ res = index.add_object!({"firstname" => "Jimmie",
533
595
  ```
534
596
 
535
597
 
536
- If you want to ensure multiple objects have been indexed, you can only check the biggest taskID with `wait_task`.
598
+ If you want to ensure multiple objects have been indexed, you only need check the biggest taskID with `wait_task`.
537
599
 
538
600
  Batch writes
539
601
  -------------
540
602
 
541
603
  You may want to perform multiple operations with one API call to reduce latency.
542
- We expose three methods to perform batch:
543
- * `add_objects`: add an array of object using automatic `objectID` assignement
544
- * `save_objects`: add or update an array of object that contains an `objectID` attribute
545
- * `delete_objects`: delete an array of objectIDs
546
- * `partial_update_objects`: partially update an array of objects that contain an `objectID` attribute (only specified attributes will be updated, other will remain unchanged)
604
+ We expose three methods to perform batch operations:
605
+ * `add_objects`: Add an array of objects using automatic `objectID` assignment.
606
+ * `save_objects`: Add or update an array of objects that contains an `objectID` attribute.
607
+ * `delete_objects`: Delete an array of objectIDs.
608
+ * `partial_update_objects`: Partially update an array of objects that contain an `objectID` attribute (only specified attributes will be updated).
547
609
 
548
- Example using automatic `objectID` assignement:
610
+ Example using automatic `objectID` assignment:
549
611
  ```ruby
550
612
  res = index.add_objects([{"firstname" => "Jimmie",
551
613
  "lastname" => "Barninger"},
@@ -563,12 +625,12 @@ res = index.save_objects([{"firstname" => "Jimmie",
563
625
  "objectID" => "myID2"}])
564
626
  ```
565
627
 
566
- Example that delete a set of records:
628
+ Example that deletes a set of records:
567
629
  ```ruby
568
630
  res = index.delete_objects(["myID1", "myID2"])
569
631
  ```
570
632
 
571
- Example that update only the `firstname` attribute:
633
+ Example that updates only the `firstname` attribute:
572
634
  ```ruby
573
635
  res = index.partial_update_objects([{"firstname" => "Jimmie",
574
636
  "objectID" => "SFO"},
@@ -593,14 +655,16 @@ Algolia.list_user_keys
593
655
  index.list_user_keys
594
656
  ```
595
657
 
596
- Each key is defined by a set of rights that specify the authorized actions. The different rights are:
597
- * **search**: allows to search,
598
- * **browse**: allow to retrieve all index content via the browse API,
599
- * **addObject**: allows to add/update an object in the index,
600
- * **deleteObject**: allows to delete an existing object,
601
- * **deleteIndex**: allows to delete index content,
602
- * **settings**: allows to get index settings,
603
- * **editSettings**: allows to change index settings.
658
+ Each key is defined by a set of permissions that specify the authorized actions. The different permissions are:
659
+ * **search**: Allowed to search.
660
+ * **browse**: Allowed to retrieve all index contents via the browse API.
661
+ * **addObject**: Allowed to add/update an object in the index.
662
+ * **deleteObject**: Allowed to delete an existing object.
663
+ * **deleteIndex**: Allowed to delete index content.
664
+ * **settings**: allows to get index settings.
665
+ * **editSettings**: Allowed to change index settings.
666
+ * **analytics**: Allowed to retrieve analytics through the analytics API.
667
+ * **listIndexes**: Allowed to list all accessible indexes.
604
668
 
605
669
  Example of API Key creation:
606
670
  ```ruby
@@ -614,14 +678,14 @@ puts res['key']
614
678
 
615
679
  You can also create an API Key with advanced restrictions:
616
680
 
617
- * Add a validity period: the key will be valid only for a specific period of time (in seconds),
618
- * Specify the maximum number of API calls allowed from an IP address per hour. Each time an API call is performed with this key, a check is performed. If the IP at the origin of the call did more than this number of calls in the last hour, a 403 code is returned. Defaults to 0 (no rate limit). This parameter can be used to protect you from attempts at retrieving your entire content by massively querying the index.
681
+ * Add a validity period. The key will be valid for a specific period of time (in seconds).
682
+ * Specify the maximum number of API calls allowed from an IP address per hour. Each time an API call is performed with this key, a check is performed. If the IP at the source of the call did more than this number of calls in the last hour, a 403 code is returned. Defaults to 0 (no rate limit). This parameter can be used to protect you from attempts at retrieving your entire index contents by massively querying the index.
619
683
 
620
684
 
621
685
  Note: If you are sending the query through your servers, you must use the `Algolia.with_rate_limits("EndUserIP", "APIKeyWithRateLimit") do ... end` block to enable rate-limit.
622
686
 
623
- * Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited). This parameter can be used to protect you from attempts at retrieving your entire content by massively querying the index.
624
- * Specify the list of targeted indices, you can target all indices starting by a prefix or finishing by a suffix with the '*' character (for example "dev_*" matches all indices starting by "dev_" and "*_dev" matches all indices finishing by "_dev"). Defaults to all indices if empty of blank.
687
+ * Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited). This parameter can be used to protect you from attempts at retrieving your entire index contents by massively querying the index.
688
+ * Specify the list of targeted indices. You can target all indices starting with a prefix or ending with a suffix using the '*' character. For example, "dev_*" matches all indices starting with "dev_" and "*_dev" matches all indices ending with "_dev". Defaults to all indices if empty or blank.
625
689
 
626
690
  ```ruby
627
691
  # Creates a new global API key that is valid for 300 seconds
@@ -636,7 +700,7 @@ res = index.add_user_key(["search"], 300, 100, 20, ['my_index1', 'my_index2'])
636
700
  puts res['key']
637
701
  ```
638
702
 
639
- Update the rights of an existing key:
703
+ Update the permissions of an existing key:
640
704
  ```ruby
641
705
  # Update an existing global API key that is valid for 300 seconds
642
706
  res = Algolia.update_user_key("myAPIKey", ["search"], 300)
@@ -649,7 +713,7 @@ puts res['key']
649
713
  res = index.update_user_key("myAPIKey", ["search"], 300, 100, 20, ['my_index1', 'my_index2'])
650
714
  puts res['key']
651
715
  ```
652
- Get the rights of a given key:
716
+ Get the permissions of a given key:
653
717
  ```ruby
654
718
  # Gets the rights of a global key
655
719
  Algolia.get_user_key("f420238212c54dcfad07ea0aa6d5c45f")
@@ -667,7 +731,7 @@ index.delete_user_key("71671c38001bf3ac857bc82052485107")
667
731
 
668
732
 
669
733
 
670
- You may have a single index containing per-user data. In that case, all records should be tagged with their associated user_id in order to add a `tagFilters=(public,user_42)` filter at query time to retrieve only what a user has access to. If you're using the [JavaScript client](http://github.com/algolia/algoliasearch-client-js), it will result in a security breach since the user is able to modify the `tagFilters` you've set modifying the code from the browser. To keep using the JavaScript client (recommended for optimal latency) and target secured records, you can generate secured API key from your backend:
734
+ You may have a single index containing per user data. In that case, all records should be tagged with their associated user_id in order to add a `tagFilters=(public,user_42)` filter at query time to retrieve only what a user has access to. If you're using the [JavaScript client](http://github.com/algolia/algoliasearch-client-js), it will result in a security breach since the user is able to modify the `tagFilters` you've set by modifying the code from the browser. To keep using the JavaScript client (recommended for optimal latency) and target secured records, you can generate a secured API key from your backend:
671
735
 
672
736
  ```ruby
673
737
  # generate a public API key for user 42. Here, records are tagged with:
@@ -688,7 +752,7 @@ This public API key must then be used in your JavaScript code as follow:
688
752
  </script>
689
753
  ```
690
754
 
691
- You can mix rate limits and secured API keys setting an extra `user_token` attribute both at API key generation-time and query-time. When set, a uniq user will be identified by her `IP + user_token` instead of only her `IP`. It allows you to restrict a single user to perform maximum `N` API calls per hour, even if she share her `IP` with another user.
755
+ You can mix rate limits and secured API keys by setting an extra `user_token` attribute both at API key generation time and query time. When set, a unique user will be identified by her `IP + user_token` instead of only by her `IP`. This allows you to restrict a single user to performing a maximum of `N` API calls per hour, even if she shares her `IP` with another user.
692
756
 
693
757
  ```ruby
694
758
  # generate a public API key for user 42. Here, records are tagged with:
@@ -716,7 +780,7 @@ Copy or rename an index
716
780
  -------------
717
781
 
718
782
  You can easily copy or rename an existing index using the `copy` and `move` commands.
719
- **Note**: Move and copy commands overwrite destination index.
783
+ **Note**: Move and copy commands overwrite the destination index.
720
784
 
721
785
  ```ruby
722
786
  # Rename MyIndex in MyIndexNewName
@@ -725,20 +789,20 @@ puts Algolia.move_index("MyIndex", "MyIndexNewName")
725
789
  puts Algolia.copy_index("MyIndex", "MyIndexCopy")
726
790
  ```
727
791
 
728
- The move command is particularly useful is you want to update a big index atomically from one version to another. For example, if you recreate your index `MyIndex` each night from a database by batch, you just have to:
729
- 1. Import your database in a new index using [batches](#batch-writes). Let's call this new index `MyNewIndex`.
730
- 1. Rename `MyNewIndex` in `MyIndex` using the move command. This will automatically override the old index and new queries will be served on the new one.
792
+ The move command is particularly useful if you want to update a big index atomically from one version to another. For example, if you recreate your index `MyIndex` each night from a database by batch, you only need to:
793
+ 1. Import your database into a new index using [batches](#batch-writes). Let's call this new index `MyNewIndex`.
794
+ 1. Rename `MyNewIndex` to `MyIndex` using the move command. This will automatically override the old index and new queries will be served on the new one.
731
795
 
732
796
  ```ruby
733
797
  # Rename MyNewIndex in MyIndex (and overwrite it)
734
798
  puts Algolia.move_index("MyNewIndex", "MyIndex")
735
799
  ```
736
800
 
737
- Backup / Retrieve all index content
801
+ Backup / Retrieve of all index content
738
802
  -------------
739
803
 
740
- You can retrieve all index content for backup purpose or for analytics using the browse method.
741
- This method retrieve 1000 objects by API call and support pagination.
804
+ You can retrieve all index content for backup purposes or for SEO using the browse method.
805
+ This method retrieves 1,000 objects via an API call and supports pagination.
742
806
 
743
807
  ```ruby
744
808
  # Get first page
@@ -750,10 +814,10 @@ puts index.browse(1)
750
814
  Logs
751
815
  -------------
752
816
 
753
- You can retrieve the last logs via this API. Each log entry contains:
817
+ You can retrieve the latest logs via this API. Each log entry contains:
754
818
  * Timestamp in ISO-8601 format
755
819
  * Client IP
756
- * Request Headers (API-Key is obfuscated)
820
+ * Request Headers (API Key is obfuscated)
757
821
  * Request URL
758
822
  * Request method
759
823
  * Request body
@@ -761,9 +825,14 @@ You can retrieve the last logs via this API. Each log entry contains:
761
825
  * Answer body
762
826
  * SHA1 ID of entry
763
827
 
764
- You can retrieve the logs of your last 1000 API calls and browse them using the offset/length parameters:
765
- * ***offset***: Specify the first entry to retrieve (0-based, 0 is the most recent log entry). Default to 0.
766
- * ***length***: Specify the maximum number of entries to retrieve starting at offset. Defaults to 10. Maximum allowed value: 1000.
828
+ You can retrieve the logs of your last 1,000 API calls and browse them using the offset/length parameters:
829
+ * ***offset***: Specify the first entry to retrieve (0-based, 0 is the most recent log entry). Defaults to 0.
830
+ * ***length***: Specify the maximum number of entries to retrieve starting at the offset. Defaults to 10. Maximum allowed value: 1,000.
831
+ * ***onlyErrors***: Retrieve only logs with an HTTP code different than 200 or 201. (deprecated)
832
+ * ***type***: Specify the type of logs to retrieve:
833
+ * ***query***: Retrieve only the queries.
834
+ * ***build***: Retrieve only the build operations.
835
+ * ***error***: Retrieve only the errors (same as ***onlyErrors*** parameters).
767
836
 
768
837
  ```ruby
769
838
  # Get last 10 log entries
@@ -777,7 +846,7 @@ puts Algolia.get_logs(0, 100, true).to_json
777
846
  Mock
778
847
  -------------
779
848
 
780
- For testing purpose, you may want to mock Algolia's API calls. We provide a [WebMock](https://github.com/bblimke/webmock) configuration that you can use including `algolia/webmock`:
849
+ For testing purposes, you may want to mock Algolia's API calls. We provide a [WebMock](https://github.com/bblimke/webmock) configuration that you can use including `algolia/webmock`:
781
850
 
782
851
  ```ruby
783
852
  require 'algolia/webmock'