algoliasearch 1.7.0 → 1.8.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: 09439a03773ded1c14b3085d75beca0fcd8ad5ea
4
- data.tar.gz: 0afd459775b461e96b952540f2889a54c7b8a9c6
3
+ metadata.gz: ac8623995ca3e9c6b72fe9fbd383b5299bab50bb
4
+ data.tar.gz: bd8674170dc90b586d95b84f464821e81c2557e0
5
5
  SHA512:
6
- metadata.gz: b1cb21a4b0382bf44a5319d4060a816300c53a14c43db82b5e21b89a607650b6f9bbc3e0bf02c5227c2e20488333593d630e4ac5834c0f4a520c346c5aa0c14a
7
- data.tar.gz: 65e765e1557b807f380f010c1ac2548a804e9fae494003dbb8b151bc187dd4ff9bfddff3628d8828be756ea49893b003ce5cb1b4cdee0cb91e95747f526694c3
6
+ metadata.gz: e8ad094f497aa8055eaafb7b16404112c150da2d561a9d1eb47e3211b61ebc9594b52d146032032454930e9a98e3a305cea0f1b351c2efb09628527e50f02700
7
+ data.tar.gz: 6ab947d1f2ab8c2cb4d018e2333f8ae7dbb18dd021e4f320cb93a307042b228050cc4a2f162fa02a75ed06e0cffd50420e4ec1f3d8893bb6238f1fe8e9e4ace1
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  CHANGELOG
2
2
 
3
+ 2016-04-06 1.8.0
4
+ * Upgraded to httpclient 2.7.1 (includes ruby 2.3.0 deprecation fixes)
5
+ * Upgraded WebMock URLs
6
+
3
7
  2016-01-09 1.7.0
4
8
  * New generate_secured_api_key embedding the filters in the resulting key
5
9
 
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'httpclient', '~> 2.4'
3
+ gem 'httpclient', '~> 2.7.1'
4
4
  gem 'json', '>= 1.5.1'
5
5
  gem 'rubysl', '~> 2.0', :platform => :rbx
6
6
 
@@ -16,10 +16,7 @@ end
16
16
 
17
17
  group :test do
18
18
  gem 'rspec', '>= 2.5.0'
19
- gem 'autotest'
20
- gem 'autotest-fsevent'
21
19
  gem 'redgreen'
22
- gem 'autotest-growl'
23
20
  gem 'webmock'
24
21
  gem 'simplecov'
25
22
  gem 'mime-types', '< 2.0'
@@ -1,13 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- ZenTest (4.11.0)
5
4
  addressable (2.3.7)
6
- autotest (4.4.6)
7
- ZenTest (>= 4.4.1)
8
- autotest-fsevent (0.2.10)
9
- sys-uname
10
- autotest-growl (0.2.16)
11
5
  backports (3.6.4)
12
6
  coderay (1.1.0)
13
7
  coveralls (0.7.11)
@@ -37,7 +31,7 @@ GEM
37
31
  net-http-persistent (>= 2.7)
38
32
  net-http-pipeline
39
33
  highline (1.6.21)
40
- httpclient (2.6.0.1)
34
+ httpclient (2.7.1)
41
35
  json (1.8.2)
42
36
  json (1.8.2-java)
43
37
  launchy (2.4.3)
@@ -291,8 +285,6 @@ GEM
291
285
  slop (3.6.0)
292
286
  spoon (0.0.4)
293
287
  ffi
294
- sys-uname (0.9.2)
295
- ffi (>= 1.0.0)
296
288
  term-ansicolor (1.3.0)
297
289
  tins (~> 1.0)
298
290
  thor (0.19.1)
@@ -320,12 +312,9 @@ PLATFORMS
320
312
  ruby
321
313
 
322
314
  DEPENDENCIES
323
- autotest
324
- autotest-fsevent
325
- autotest-growl
326
315
  coveralls
327
316
  highline (< 1.7.0)
328
- httpclient (~> 2.4)
317
+ httpclient (~> 2.7.1)
329
318
  json (>= 1.5.1)
330
319
  mime-types (< 2.0)
331
320
  rake
@@ -338,3 +327,6 @@ DEPENDENCIES
338
327
  simplecov
339
328
  travis
340
329
  webmock
330
+
331
+ BUNDLED WITH
332
+ 1.11.2
data/README.md CHANGED
@@ -1,12 +1,20 @@
1
+ <!--NO_HTML-->
2
+
1
3
  # Algolia Search API Client for Ruby
2
4
 
5
+ <!--/NO_HTML-->
6
+
7
+
8
+
3
9
 
4
10
 
11
+ <!--NO_HTML-->
5
12
 
13
+ [Algolia Search](https://www.algolia.com) is a hosted full-text, numerical, and faceted search engine capable of delivering realtime results from the first keystroke.
6
14
 
7
- [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.
15
+ <!--/NO_HTML-->
8
16
 
9
- Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia.com/doc/rest_api) from your backend. It wraps the [Algolia Search REST API](http://www.algolia.com/doc/rest_api).
17
+ Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia.com/doc/rest) from your backend. It wraps the [Algolia Search REST API](https://www.algolia.com/doc/rest).
10
18
 
11
19
 
12
20
 
@@ -16,14 +24,16 @@ Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia
16
24
 
17
25
 
18
26
 
27
+ <!--NO_HTML-->
28
+
19
29
  Table of Contents
20
- =================
30
+ -----------------
21
31
  **Getting Started**
22
32
 
23
33
  1. [Setup](#setup)
24
34
  1. [Quick Start](#quick-start)
25
- 1. [Online documentation](#documentation)
26
- 1. [Tutorials](#tutorials)
35
+
36
+ 1. [Guides & Tutorials](#guides-tutorials)
27
37
 
28
38
 
29
39
  **Commands Reference**
@@ -47,14 +57,17 @@ Table of Contents
47
57
  1. [Logs](#logs)
48
58
  1. [Mock](#mock)
49
59
 
60
+ <!--/NO_HTML-->
61
+
50
62
 
51
63
 
52
64
  Setup
53
- -------------
65
+ ============
54
66
  To setup your project, follow these steps:
55
67
 
56
68
 
57
69
 
70
+
58
71
  1. Install AlgoliaSearch using <code>gem install algoliasearch</code>.
59
72
  2. Initialize the client with your ApplicationID and API-Key. You can find all of them on [your Algolia account](http://www.algolia.com/users/edit).
60
73
 
@@ -115,7 +128,7 @@ puts index.search('jim').to_json
115
128
  ```
116
129
 
117
130
 
118
- **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:
131
+ **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 perform queries. It brings two benefits:
119
132
  * Your users get a better response time by not going through your servers
120
133
  * It will offload unnecessary tasks from your servers
121
134
 
@@ -152,38 +165,36 @@ function searchCallback(err, content) {
152
165
 
153
166
 
154
167
 
155
- Documentation
156
- ================
157
- Check our [online documentation](http://www.algolia.com/doc/guides/ruby):
158
- * [Initial Import](http://www.algolia.com/doc/guides/ruby#InitialImport)
159
- * [Ranking &amp; Relevance](http://www.algolia.com/doc/guides/ruby#RankingRelevance)
160
- * [Indexing](http://www.algolia.com/doc/guides/ruby#Indexing)
161
- * [Search](http://www.algolia.com/doc/guides/ruby#Search)
162
- * [Sorting](http://www.algolia.com/doc/guides/ruby#Sorting)
163
- * [Filtering](http://www.algolia.com/doc/guides/ruby#Filtering)
164
- * [Faceting](http://www.algolia.com/doc/guides/ruby#Faceting)
165
- * [Geo-Search](http://www.algolia.com/doc/guides/ruby#Geo-Search)
166
- * [Security](http://www.algolia.com/doc/guides/ruby#Security)
167
- * [REST API](http://www.algolia.com/doc/rest)
168
-
169
- Tutorials
168
+
169
+
170
+ <!--NO_HTML-->
171
+
172
+ Guides & Tutorials
170
173
  ================
174
+ Check our [online guides](https://www.algolia.com/doc):
175
+ * [Data Formatting](https://www.algolia.com/doc/indexing/formatting-your-data)
176
+ * [Import and Synchronize data](https://www.algolia.com/doc/indexing/import-synchronize-data/ruby)
177
+ * [Autocomplete](https://www.algolia.com/doc/search/auto-complete)
178
+ * [Instant search page](https://www.algolia.com/doc/search/instant-search)
179
+ * [Filtering and Faceting](https://www.algolia.com/doc/search/filtering-faceting)
180
+ * [Sorting](https://www.algolia.com/doc/relevance/sorting)
181
+ * [Ranking Formula](https://www.algolia.com/doc/relevance/ranking)
182
+ * [Typo-Tolerance](https://www.algolia.com/doc/relevance/typo-tolerance)
183
+ * [Geo-Search](https://www.algolia.com/doc/geo-search/geo-search-overview)
184
+ * [Security](https://www.algolia.com/doc/security/best-security-practices)
185
+ * [API-Keys](https://www.algolia.com/doc/security/api-keys)
186
+ * [REST API](https://www.algolia.com/doc/rest)
171
187
 
172
- Check out our [tutorials](http://www.algolia.com/doc/tutorials):
173
- * [Search bar with autocomplete menu](http://www.algolia.com/doc/tutorials/auto-complete)
174
- * [Search bar with multi category autocomplete menu](http://www.algolia.com/doc/tutorials/multi-auto-complete)
175
- * [Instant search result pages](http://www.algolia.com/doc/tutorials/instant-search)
176
188
 
189
+ <!--/NO_HTML-->
177
190
 
178
191
 
179
192
 
180
- Commands Reference
181
- ==================
182
193
 
183
194
 
184
195
 
185
196
  Add a new object to the Index
186
- -------------
197
+ ==================
187
198
 
188
199
  Each entry in an index has a unique identifier called `objectID`. There are two ways to add en entry to the index:
189
200
 
@@ -210,7 +221,7 @@ puts "ObjectID=" + res["objectID"]
210
221
  ```
211
222
 
212
223
  Update an existing object in the Index
213
- -------------
224
+ ==================
214
225
 
215
226
  You have three options when updating an existing object:
216
227
 
@@ -285,7 +296,8 @@ Note: Here we are decrementing the value by `42`. To decrement just by one, put
285
296
  `value:1`.
286
297
 
287
298
  Search
288
- -------------
299
+ ==================
300
+
289
301
 
290
302
  **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:
291
303
  * Your users get a better response time by not going through your servers
@@ -296,108 +308,6 @@ To perform a search, you only need to initialize the index and perform a call to
296
308
 
297
309
  The search query allows only to retrieve 1000 hits, if you need to retrieve more than 1000 hits for seo, you can use [Backup / Retrieve all index content](#backup--retrieve-of-all-index-content)
298
310
 
299
- You can use the following optional arguments:
300
-
301
- ### Query Parameters
302
-
303
- #### Full Text Search Parameters
304
-
305
- * **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.
306
- * **queryType**: Selects how the query words are interpreted. It can be one of the following values:
307
- * **prefixAll**: All query words are interpreted as prefixes.
308
- * **prefixLast**: Only the last word is interpreted as a prefix (default behavior).
309
- * **prefixNone**: No query word is interpreted as a prefix. This option is not recommended.
310
- * **removeWordsIfNoResults**: This option is used to select a strategy in order to avoid having an empty result page. There are three different options:
311
- * **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.
312
- * **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.
313
- * **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.
314
- * **none**: No specific processing is done when a query does not return any results (default behavior).
315
- * **minWordSizefor1Typo**: The minimum number of characters in a query word to accept one typo in this word.<br/>Defaults to 4.
316
- * **minWordSizefor2Typos**: The minimum number of characters in a query word to accept two typos in this word.<br/>Defaults to 8.
317
- * **allowTyposOnNumericTokens**: If set to false, it disables typo tolerance on numeric tokens (numbers). Defaults to false.
318
- * **typoTolerance**: This option allows you to control the number of typos in the result set:
319
- * **true**: The typo tolerance is enabled and all matching hits are retrieved (default behavior).
320
- * **false**: The typo tolerance is disabled. For example, if one result matches without typos, then all results with typos will be hidden.
321
- * **min**: Only keep results with the minimum number of typos.
322
- * **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.
323
- * **allowTyposOnNumericTokens**: If set to false, disables typo tolerance on numeric tokens (numbers). Defaults to true.
324
- * **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.
325
- * **disableTypoToleranceOnAttributes** List of attributes on which you want to disable typo tolerance (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, this list is empty.
326
- * **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.
327
- * **removeStopWords**: Remove stop words from query before executing it. Defaults to false. Contains stop words for 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu).
328
- * **advancedSyntax**: Enables the advanced query syntax. Defaults to 0 (false).
329
- * **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.
330
- * **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`.
331
- * **analytics**: If set to false, this query will not be taken into account in the analytics feature. Defaults to true.
332
- * **synonyms**: If set to false, this query will not use synonyms defined in the configuration. Defaults to true.
333
- * **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.
334
- * **optionalWords**: A string that contains the comma separated list of words that should be considered as optional when found in the query.
335
-
336
- #### Pagination Parameters
337
-
338
- * **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`.
339
- * **hitsPerPage**: (integer) Pagination parameter used to select the number of hits per page. Defaults to 20.
340
-
341
- #### Geo-search Parameters
342
-
343
- * **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/>By default the maximum distance is automatically guessed based on the density of the area but you can specify it manually in meters with the **aroundRadius** parameter. The precision for ranking can be set with **aroundPrecision** parameter. For example, if you set aroundPrecision=100, the distances will be considered by ranges of 100m, for example all distances 0 and 100m will be considered as identical for the "geo" ranking parameter.<br/>When **aroundRadius** is not set, the radius is computed automatically using the density of the area, you can retrieve the computed radius in the **automaticRadius** attribute of the answer, you can also use the **minimumAroundRadius** query parameter to specify a minimum radius in meters for the automatic computation of **aroundRadius**.<br/>At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form `"_geoloc":{"lat":48.853409, "lng":2.348800}` or `"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}]` if you have several geo-locations in your record).
344
-
345
- * **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 in the range 0-99m will be considered as identic in the ranking for the "geo" ranking parameter (same for 100-199, 200-299, ... ranges).<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}}`.
346
-
347
- * **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}` or `"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}]` if you have several geo-locations in your record). You can use several bounding boxes (OR) by passing more than 4 values. For example instead of having 4 values you can pass 8 to use or OR between two bounding boxes.
348
- * **insidePolygon**: Search entries inside a given area defined by a set of points (defined by a minimum of 6 floats: p1Lat,p1Lng,p2Lat,p2Lng,p3Lat,p3Long).<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}` or `"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}]` if you have several geo-locations in your record).
349
-
350
- #### Parameters to Control Results Content
351
-
352
- * **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.
353
- * **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:
354
- * **full**: If all the query terms were found in the attribute.
355
- * **partial**: If only some of the query terms were found.
356
- * **none**: If none of the query terms were found.
357
- * **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.
358
- * **getRankingInfo**: If set to 1, the result hits will contain ranking information in the **_rankingInfo** attribute.
359
- * **highlightPreTag**: (string) Specify the string that is inserted before the highlighted parts in the query result (defaults to "&lt;em&gt;").
360
- * **highlightPostTag**: (string) Specify the string that is inserted after the highlighted parts in the query result (defaults to "&lt;/em&gt;").
361
-
362
-
363
- #### Numeric Search Parameters
364
- * **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 `>=`.
365
-
366
- You can easily perform range queries via the `:` operator. This is equivalent to combining a `>=` and `<=` operand. For example, `numericFilters=price:10 to 1000`.
367
-
368
- 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)")`.
369
-
370
- You can also use a string array encoding (for example `numericFilters: ["price>100","price<1000"]`).
371
-
372
- #### Category Search Parameters
373
- * **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"]}`.
374
-
375
- #### Faceting Parameters
376
- * **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"]`.
377
- * **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**. If the number of results is important, the count can be approximate, the attribute `exhaustiveFacetsCount` in the response is true when the count is exact.
378
- * **maxValuesPerFacet**: Limit the number of facet values returned for each facet. For example, `maxValuesPerFacet=10` will retrieve a maximum of 10 values per facet.
379
-
380
- #### UNIFIED FILTER PARAMETER (SQL LIKE)
381
- * **filters**: Filter the query with numeric, facet or/and tag filters. The syntax is a SQL like syntax, you can use the OR and AND keywords. The syntax for the underlying numeric, facet and tag filters is the same than in the other filters:
382
- `available=1 AND (category:Book OR NOT category:Ebook) AND public`
383
- `date: 1441745506 TO 1441755506 AND inStock > 0 AND author:"John Doe"`
384
- The list of keywords is:
385
- **OR**: create a disjunctive filter between two filters.
386
- **AND**: create a conjunctive filter between two filters.
387
- **TO**: used to specify a range for a numeric filter.
388
- **NOT**: used to negate a filter. The syntax with the ‘-‘ isn’t allowed.
389
-
390
- *Note*: To specify a value with spaces or with a value equal to a keyword, it's possible to add quotes.
391
-
392
- **Warning:**
393
- * Like for the other filter for performance reason, it's not possible to have FILTER1 OR (FILTER2 AND FILTER3).
394
- * It's not possible to mix different category of filter inside a OR like num=3 OR tag1 OR facet:value
395
- * It's not possible to negate an group, it's only possible to negate a filters: NOT(FILTER1 OR (FILTER2) is not allowed.
396
-
397
-
398
- #### Distinct Parameter
399
- * **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.
400
-
401
311
  ```ruby
402
312
  index = Algolia::Index.new("contacts")
403
313
  res = index.search("query string")
@@ -439,12 +349,760 @@ The server response will look like:
439
349
  }
440
350
  ```
441
351
 
352
+ You can use the following optional arguments:
353
+
354
+ ## Full Text Search Parameters
355
+ <table><tbody>
356
+
357
+
358
+ <tr>
359
+ <td valign='top'>
360
+ <div class='client-readme-param-container'>
361
+ <div class='client-readme-param-container-inner'>
362
+ <div class='client-readme-param-name'><code>query</code></div>
363
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div></div>
364
+ </div>
365
+ </div>
366
+ </td>
367
+ <td class='client-readme-param-content'>
368
+ <p>The instant search query string, used to set the string you want to search in your index. If no query parameter is set, the textual search will match with all the objects.</p>
369
+
370
+ </td>
371
+ </tr>
372
+
373
+
374
+
375
+ <tr>
376
+ <td valign='top'>
377
+ <div class='client-readme-param-container'>
378
+ <div class='client-readme-param-container-inner'>
379
+ <div class='client-readme-param-name'><code>queryType</code></div>
380
+ <div class="client-readme-param-meta"><div><em>Default: <strong>prefixLast</strong></em></div></div>
381
+ </div>
382
+ </div>
383
+ </td>
384
+ <td class='client-readme-param-content'>
385
+ <p>Selects how the query words are interpreted. It can be one of the following values:</p>
386
+
387
+ <ul>
388
+ <li><code>prefixAll</code>: All query words are interpreted as prefixes. This option is not recommended.</li>
389
+ <li><code>prefixLast</code>: Only the last word is interpreted as a prefix (default behavior).</li>
390
+ <li><code>prefixNone</code>: No query word is interpreted as a prefix. This option is not recommended.</li>
391
+ </ul>
392
+
393
+ </td>
394
+ </tr>
395
+
396
+
397
+
398
+ <tr>
399
+ <td valign='top'>
400
+ <div class='client-readme-param-container'>
401
+ <div class='client-readme-param-container-inner'>
402
+ <div class='client-readme-param-name'><code>removeWordsIfNoResults</code></div>
403
+ <div class="client-readme-param-meta"><div><em>Default: <strong>none</strong></em></div></div>
404
+ </div>
405
+ </div>
406
+ </td>
407
+ <td class='client-readme-param-content'>
408
+ <p>This option is used to select a strategy in order to avoid having an empty result page. There are three different options:</p>
409
+
410
+ <ul>
411
+ <li><code>lastWords</code>: 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.</li>
412
+ <li><code>firstWords</code>: 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.</li>
413
+ <li><code>allOptional</code>: 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.</li>
414
+ <li><code>none</code>: No specific processing is done when a query does not return any results (default behavior).</li>
415
+ </ul>
416
+
417
+ </td>
418
+ </tr>
419
+
420
+
421
+
422
+ <tr>
423
+ <td valign='top'>
424
+ <div class='client-readme-param-container'>
425
+ <div class='client-readme-param-container-inner'>
426
+ <div class='client-readme-param-name'><code>minWordSizefor1Typo</code></div>
427
+ <div class="client-readme-param-meta"><div><em>Type: <strong>number</strong></em></div><div><em>Default: <strong>4</strong></em></div></div>
428
+ </div>
429
+ </div>
430
+ </td>
431
+ <td class='client-readme-param-content'>
432
+ <p>The minimum number of characters in a query word to accept one typo in this word.<br/>Defaults to 4.</p>
433
+
434
+ </td>
435
+ </tr>
436
+
437
+
438
+
439
+ <tr>
440
+ <td valign='top'>
441
+ <div class='client-readme-param-container'>
442
+ <div class='client-readme-param-container-inner'>
443
+ <div class='client-readme-param-name'><code>minWordSizefor2Typos</code></div>
444
+ <div class="client-readme-param-meta"><div><em>Type: <strong>number</strong></em></div><div><em>Default: <strong>8</strong></em></div></div>
445
+ </div>
446
+ </div>
447
+ </td>
448
+ <td class='client-readme-param-content'>
449
+ <p>The minimum number of characters in a query word to accept two typos in this word.<br/>Defaults to 8.</p>
450
+
451
+ </td>
452
+ </tr>
453
+
454
+
455
+
456
+ <tr>
457
+ <td valign='top'>
458
+ <div class='client-readme-param-container'>
459
+ <div class='client-readme-param-container-inner'>
460
+ <div class='client-readme-param-name'><code>typoTolerance</code></div>
461
+ <div class="client-readme-param-meta"><div><em>Default: <strong>true</strong></em></div></div>
462
+ </div>
463
+ </div>
464
+ </td>
465
+ <td class='client-readme-param-content'>
466
+ <p>This option allows you to control the number of typos allowed in the result set:</p>
467
+
468
+ <ul>
469
+ <li><code>true</code>: The typo tolerance is enabled and all matching hits are retrieved (default behavior).</li>
470
+ <li><code>false</code>: The typo tolerance is disabled. All results with typos will be hidden.</li>
471
+ <li><code>min</code>: Only keep results with the minimum number of typos. For example, if one result matches without typos, then all results with typos will be hidden.</li>
472
+ <li><code>strict</code>: Hits matching with 2 typos are not retrieved if there are some matching without typos.</li>
473
+ </ul>
474
+
475
+ </td>
476
+ </tr>
477
+
478
+
479
+
480
+ <tr>
481
+ <td valign='top'>
482
+ <div class='client-readme-param-container'>
483
+ <div class='client-readme-param-container-inner'>
484
+ <div class='client-readme-param-name'><code>allowTyposOnNumericTokens</code></div>
485
+ <div class="client-readme-param-meta"><div><em>Default: <strong>true</strong></em></div></div>
486
+ </div>
487
+ </div>
488
+ </td>
489
+ <td class='client-readme-param-content'>
490
+ <p>If set to false, disables typo tolerance on numeric tokens (numbers). Defaults to true.</p>
491
+
492
+ </td>
493
+ </tr>
494
+
495
+
496
+
497
+ <tr>
498
+ <td valign='top'>
499
+ <div class='client-readme-param-container'>
500
+ <div class='client-readme-param-container-inner'>
501
+ <div class='client-readme-param-name'><code>ignorePlural</code></div>
502
+ <div class="client-readme-param-meta"><div><em>Default: <strong>false</strong></em></div></div>
503
+ </div>
504
+ </div>
505
+ </td>
506
+ <td class='client-readme-param-content'>
507
+ <p>If set to true, plural won&#39;t be considered as a typo. For example, car and cars, or foot and feet will be considered as equivalent. Defaults to false.</p>
508
+
509
+ </td>
510
+ </tr>
511
+
512
+
513
+
514
+ <tr>
515
+ <td valign='top'>
516
+ <div class='client-readme-param-container'>
517
+ <div class='client-readme-param-container-inner'>
518
+ <div class='client-readme-param-name'><code>disableTypoToleranceOnAttributes</code></div>
519
+ <div class="client-readme-param-meta"><div><em>Default: <strong>[]</strong></em></div></div>
520
+ </div>
521
+ </div>
522
+ </td>
523
+ <td class='client-readme-param-content'>
524
+ <p>List of attributes on which you want to disable typo tolerance (must be a subset of the <code>attributesToIndex</code> index setting). Attributes are separated with a comma such as <code>&quot;name,address&quot;</code>. You can also use JSON string array encoding such as <code>encodeURIComponent(&quot;[\&quot;name\&quot;,\&quot;address\&quot;]&quot;)</code>. By default, this list is empty.</p>
525
+
526
+ </td>
527
+ </tr>
528
+
529
+
530
+
531
+ <tr>
532
+ <td valign='top'>
533
+ <div class='client-readme-param-container'>
534
+ <div class='client-readme-param-container-inner'>
535
+ <div class='client-readme-param-name'><code>restrictSearchableAttributes</code></div>
536
+ <div class="client-readme-param-meta"><div><em>Default: <strong>attributesToIndex</strong></em></div></div>
537
+ </div>
538
+ </div>
539
+ </td>
540
+ <td class='client-readme-param-content'>
541
+ <p>List of attributes you want to use for textual search (must be a subset of the <code>attributesToIndex</code> index setting). Attributes are separated with a comma such as <code>&quot;name,address&quot;</code>. You can also use JSON string array encoding such as <code>encodeURIComponent(&quot;[\&quot;name\&quot;,\&quot;address\&quot;]&quot;)</code>. By default, all attributes specified in the <code>attributesToIndex</code> settings are used to search.</p>
542
+
543
+ </td>
544
+ </tr>
545
+
546
+
547
+
548
+ <tr>
549
+ <td valign='top'>
550
+ <div class='client-readme-param-container'>
551
+ <div class='client-readme-param-container-inner'>
552
+ <div class='client-readme-param-name'><code>removeStopWords</code></div>
553
+ <div class="client-readme-param-meta"><div><em>Default: <strong>false</strong></em></div></div>
554
+ </div>
555
+ </div>
556
+ </td>
557
+ <td class='client-readme-param-content'>
558
+ <p>Remove the stop words from query before executing it. Defaults to false. Contains a list of stop words from 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu). In most use-cases, we don&#39;t recommend enabling this option.</p>
559
+
560
+ </td>
561
+ </tr>
562
+
563
+
564
+
565
+ <tr>
566
+ <td valign='top'>
567
+ <div class='client-readme-param-container'>
568
+ <div class='client-readme-param-container-inner'>
569
+ <div class='client-readme-param-name'><code>advancedSyntax</code></div>
570
+ <div class="client-readme-param-meta"><div><em>Default: <strong>0 (false)</strong></em></div></div>
571
+ </div>
572
+ </div>
573
+ </td>
574
+ <td class='client-readme-param-content'>
575
+ <p>Enables the advanced query syntax. Defaults to 0 (false).</p>
576
+
577
+ <ul>
578
+ <li><strong>Phrase query</strong>: A phrase query defines a particular sequence of terms. A phrase query is built by Algolia&#39;s query parser for words surrounded by <code>&quot;</code>. For example, <code>&quot;search engine&quot;</code> will retrieve records having <code>search</code> next to <code>engine</code> only. Typo tolerance is <em>disabled</em> on phrase queries.</li>
579
+ <li><strong>Prohibit operator</strong>: The prohibit operator excludes records that contain the term after the <code>-</code> symbol. For example, <code>search -engine</code> will retrieve records containing <code>search</code> but not <code>engine</code>.</li>
580
+ </ul>
581
+
582
+ </td>
583
+ </tr>
584
+
585
+
586
+
587
+ <tr>
588
+ <td valign='top'>
589
+ <div class='client-readme-param-container'>
590
+ <div class='client-readme-param-container-inner'>
591
+ <div class='client-readme-param-name'><code>analytics</code></div>
592
+ <div class="client-readme-param-meta"><div><em>Default: <strong>true</strong></em></div></div>
593
+ </div>
594
+ </div>
595
+ </td>
596
+ <td class='client-readme-param-content'>
597
+ <p>If set to false, this query will not be taken into account in the analytics feature. Defaults to true.</p>
598
+
599
+ </td>
600
+ </tr>
601
+
602
+
603
+
604
+ <tr>
605
+ <td valign='top'>
606
+ <div class='client-readme-param-container'>
607
+ <div class='client-readme-param-container-inner'>
608
+ <div class='client-readme-param-name'><code>synonyms</code></div>
609
+ <div class="client-readme-param-meta"><div><em>Default: <strong>true</strong></em></div></div>
610
+ </div>
611
+ </div>
612
+ </td>
613
+ <td class='client-readme-param-content'>
614
+ <p>If set to false, this query will not use synonyms defined in the configuration. Defaults to true.</p>
615
+
616
+ </td>
617
+ </tr>
618
+
619
+
620
+
621
+ <tr>
622
+ <td valign='top'>
623
+ <div class='client-readme-param-container'>
624
+ <div class='client-readme-param-container-inner'>
625
+ <div class='client-readme-param-name'><code>replaceSynonymsInHighlight</code></div>
626
+ <div class="client-readme-param-meta"><div><em>Default: <strong>true</strong></em></div></div>
627
+ </div>
628
+ </div>
629
+ </td>
630
+ <td class='client-readme-param-content'>
631
+ <p>If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlight results. Defaults to true.</p>
632
+
633
+ </td>
634
+ </tr>
635
+
636
+
637
+
638
+ <tr>
639
+ <td valign='top'>
640
+ <div class='client-readme-param-container'>
641
+ <div class='client-readme-param-container-inner'>
642
+ <div class='client-readme-param-name'><code>optionalWords</code></div>
643
+ <div class="client-readme-param-meta"><div><em>Default: <strong>[]</strong></em></div></div>
644
+ </div>
645
+ </div>
646
+ </td>
647
+ <td class='client-readme-param-content'>
648
+ <p>A string that contains the comma separated list of words that should be considered as optional when found in the query.</p>
649
+
650
+ </td>
651
+ </tr>
652
+
653
+
654
+ </tbody></table>
655
+
656
+ ## Pagination Parameters
657
+
658
+ <table><tbody>
659
+
660
+
661
+ <tr>
662
+ <td valign='top'>
663
+ <div class='client-readme-param-container'>
664
+ <div class='client-readme-param-container-inner'>
665
+ <div class='client-readme-param-name'><code>page</code></div>
666
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div><div><em>Default: <strong>0</strong></em></div></div>
667
+ </div>
668
+ </div>
669
+ </td>
670
+ <td class='client-readme-param-content'>
671
+ <p>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 <code>page=9</code>.</p>
672
+
673
+ </td>
674
+ </tr>
675
+
676
+
677
+
678
+ <tr>
679
+ <td valign='top'>
680
+ <div class='client-readme-param-container'>
681
+ <div class='client-readme-param-container-inner'>
682
+ <div class='client-readme-param-name'><code>hitsPerPage</code></div>
683
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div><div><em>Default: <strong>20</strong></em></div></div>
684
+ </div>
685
+ </div>
686
+ </td>
687
+ <td class='client-readme-param-content'>
688
+ <p>Pagination parameter used to select the number of hits per page. Defaults to 20.</p>
689
+
690
+ </td>
691
+ </tr>
692
+
693
+
694
+ </tbody></table>
695
+
696
+
697
+ ## Geo-search Parameters
698
+ <table><tbody>
699
+
700
+
701
+
702
+ <tr>
703
+ <td valign='top'>
704
+ <div class='client-readme-param-container'>
705
+ <div class='client-readme-param-container-inner'>
706
+ <div class='client-readme-param-name'><code>aroundLatLng</code></div>
707
+
708
+ </div>
709
+ </div>
710
+ </td>
711
+ <td class='client-readme-param-content'>
712
+ <p>Search for entries around a given latitude/longitude (specified as two floats separated by a comma).<br/>For example, <code>aroundLatLng=47.316669,5.016670</code>.</p>
713
+
714
+ <p>By default the maximum distance is automatically guessed based on the density of the area but you can specify it manually in meters with the <strong>aroundRadius</strong> parameter. The precision for ranking can be set with <strong>aroundPrecision</strong> parameter. For example, if you set aroundPrecision=100, the distances will be considered by ranges of 100m, for example all distances 0 and 100m will be considered as identical for the &quot;geo&quot; ranking parameter.<br/><br/>When <strong>aroundRadius</strong> is not set, the radius is computed automatically using the density of the area, you can retrieve the computed radius in the <strong>automaticRadius</strong> attribute of the answer, you can also use the <strong>minimumAroundRadius</strong> query parameter to specify a minimum radius in meters for the automatic computation of <strong>aroundRadius</strong>.</p>
715
+
716
+ <p>At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form <code>&quot;_geoloc&quot;:{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800}</code> or <code>&quot;_geoloc&quot;:[{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800},{&quot;lat&quot;:48.547456, &quot;lng&quot;:2.972075}]</code> if you have several geo-locations in your record).</p>
717
+
718
+ </td>
719
+ </tr>
720
+
721
+
722
+
723
+
724
+
725
+
726
+ <tr>
727
+ <td valign='top'>
728
+ <div class='client-readme-param-container'>
729
+ <div class='client-readme-param-container-inner'>
730
+ <div class='client-readme-param-name'><code>aroundLatLngViaIP</code></div>
731
+
732
+ </div>
733
+ </div>
734
+ </td>
735
+ <td class='client-readme-param-content'>
736
+ <p>Search for entries around a given latitude/longitude automatically computed from user IP address.<br/>To enable it, use <code>aroundLatLngViaIP=true</code>.</p>
737
+
738
+ <p>You can specify the maximum distance in meters with the <code>aroundRadius</code> parameter and the precision for ranking with <code>aroundPrecision</code>. For example, if you set aroundPrecision=100, two objects that are in the range 0-99m will be considered as identical in the ranking for the &quot;geo&quot; ranking parameter (same for 100-199, 200-299, ... ranges).</p>
739
+
740
+ <p>At indexing, you should specify the geo location of an object with the <code>_geoloc</code> attribute in the form <code>{&quot;_geoloc&quot;:{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800}}</code>.</p>
741
+
742
+ </td>
743
+ </tr>
744
+
745
+
746
+
747
+
748
+
749
+ <tr>
750
+ <td valign='top'>
751
+ <div class='client-readme-param-container'>
752
+ <div class='client-readme-param-container-inner'>
753
+ <div class='client-readme-param-name'><code>insideBoundingBox</code></div>
754
+
755
+ </div>
756
+ </div>
757
+ </td>
758
+ <td class='client-readme-param-content'>
759
+ <p>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, <code>insideBoundingBox=47.3165,4.9665,47.3424,5.0201</code>).<br/>At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form <code>&quot;_geoloc&quot;:{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800}</code> or <code>&quot;_geoloc&quot;:[{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800},{&quot;lat&quot;:48.547456, &quot;lng&quot;:2.972075}]</code> if you have several geo-locations in your record). You can use several bounding boxes (OR) by passing more than 4 values. For example instead of having 4 values you can pass 8 to search inside the UNION of two bounding boxes.</p>
760
+
761
+ </td>
762
+ </tr>
763
+
764
+
765
+
766
+ <tr>
767
+ <td valign='top'>
768
+ <div class='client-readme-param-container'>
769
+ <div class='client-readme-param-container-inner'>
770
+ <div class='client-readme-param-name'><code>insidePolygon</code></div>
771
+
772
+ </div>
773
+ </div>
774
+ </td>
775
+ <td class='client-readme-param-content'>
776
+ <p>Search entries inside a given area defined by a set of points (defined by a minimum of 6 floats: p1Lat,p1Lng,p2Lat,p2Lng,p3Lat,p3Long).<br/>For example <code>InsidePolygon=47.3165,4.9665,47.3424,5.0201,47.32,4.98</code>).<br/>At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form <code>&quot;_geoloc&quot;:{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800}</code> or <code>&quot;_geoloc&quot;:[{&quot;lat&quot;:48.853409, &quot;lng&quot;:2.348800},{&quot;lat&quot;:48.547456, &quot;lng&quot;:2.972075}]</code> if you have several geo-locations in your record).</p>
777
+
778
+ </td>
779
+ </tr>
780
+
781
+
782
+ </tbody></table>
783
+
784
+
785
+ ## Parameters to Control Results Content
786
+
787
+ <table><tbody>
788
+
789
+
790
+ <tr>
791
+ <td valign='top'>
792
+ <div class='client-readme-param-container'>
793
+ <div class='client-readme-param-container-inner'>
794
+ <div class='client-readme-param-name'><code>attributesToRetrieve</code></div>
795
+
796
+ </div>
797
+ </div>
798
+ </td>
799
+ <td class='client-readme-param-content'>
800
+ <p>A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.</p>
801
+
802
+ <p>Attributes are separated with a comma (for example <code>&quot;name,address&quot;</code>). You can also use a string array encoding (for example <code>[&quot;name&quot;,&quot;address&quot;]</code> ). By default, all attributes are retrieved. You can also use <code>*</code> to retrieve all values when an <strong>attributesToRetrieve</strong> setting is specified for your index.</p>
803
+
804
+ </td>
805
+ </tr>
806
+
807
+
808
+
809
+ <tr>
810
+ <td valign='top'>
811
+ <div class='client-readme-param-container'>
812
+ <div class='client-readme-param-container-inner'>
813
+ <div class='client-readme-param-name'><code>attributesToHighlight</code></div>
814
+
815
+ </div>
816
+ </div>
817
+ </td>
818
+ <td class='client-readme-param-content'>
819
+ <p>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 <code>[&quot;name&quot;,&quot;address&quot;]</code>). If an attribute has no match for the query, the raw value is returned. By default, all indexed attributes are highlighted. You can use <code>*</code> if you want to highlight all attributes. A matchLevel is returned for each highlighted attribute and can contain:</p>
820
+
821
+ <ul>
822
+ <li><strong>full</strong>: If all the query terms were found in the attribute.</li>
823
+ <li><strong>partial</strong>: If only some of the query terms were found.</li>
824
+ <li><strong>none</strong>: If none of the query terms were found.</li>
825
+ </ul>
826
+
827
+ </td>
828
+ </tr>
829
+
830
+
831
+
832
+ <tr>
833
+ <td valign='top'>
834
+ <div class='client-readme-param-container'>
835
+ <div class='client-readme-param-container-inner'>
836
+ <div class='client-readme-param-name'><code>attributesToSnippet</code></div>
837
+
838
+ </div>
839
+ </div>
840
+ </td>
841
+ <td class='client-readme-param-content'>
842
+ <p>A string that contains the list of attributes to snippet alongside the number of words to return (syntax is <code>attributeName:nbWords</code>). Attributes are separated by commas (Example: <code>attributesToSnippet=name:10,content:10</code>).</p>
843
+
844
+ <p>You can also use a string array encoding (Example: <code>attributesToSnippet: [&quot;name:10&quot;,&quot;content:10&quot;]</code>). By default, no snippet is computed.</p>
845
+
846
+ </td>
847
+ </tr>
848
+
849
+
850
+
851
+ <tr>
852
+ <td valign='top'>
853
+ <div class='client-readme-param-container'>
854
+ <div class='client-readme-param-container-inner'>
855
+ <div class='client-readme-param-name'><code>getRankingInfo</code></div>
856
+
857
+ </div>
858
+ </div>
859
+ </td>
860
+ <td class='client-readme-param-content'>
861
+ <p>If set to 1, the result hits will contain ranking information in the <code>_rankingInfo</code> attribute.</p>
862
+
863
+ </td>
864
+ </tr>
865
+
866
+
867
+
868
+ <tr>
869
+ <td valign='top'>
870
+ <div class='client-readme-param-container'>
871
+ <div class='client-readme-param-container-inner'>
872
+ <div class='client-readme-param-name'><code>highlightPreTag</code></div>
873
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>&lt;em&gt;</strong></em></div></div>
874
+ </div>
875
+ </div>
876
+ </td>
877
+ <td class='client-readme-param-content'>
878
+ <p>Specify the string that is inserted before the highlighted parts in the query result (defaults to <code>&lt;em&gt;</code>).</p>
879
+
880
+ </td>
881
+ </tr>
882
+
883
+
884
+
885
+ <tr>
886
+ <td valign='top'>
887
+ <div class='client-readme-param-container'>
888
+ <div class='client-readme-param-container-inner'>
889
+ <div class='client-readme-param-name'><code>highlightPostTag</code></div>
890
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>&lt;/em&gt;</strong></em></div></div>
891
+ </div>
892
+ </div>
893
+ </td>
894
+ <td class='client-readme-param-content'>
895
+ <p>Specify the string that is inserted after the highlighted parts in the query result (defaults to <code>&lt;/em&gt;</code>)</p>
896
+
897
+ </td>
898
+ </tr>
899
+
900
+
901
+
902
+ <tr>
903
+ <td valign='top'>
904
+ <div class='client-readme-param-container'>
905
+ <div class='client-readme-param-container-inner'>
906
+ <div class='client-readme-param-name'><code>snippetEllipsisText</code></div>
907
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>''</strong></em></div></div>
908
+ </div>
909
+ </div>
910
+ </td>
911
+ <td class='client-readme-param-content'>
912
+ <p>String used as an ellipsis indicator when a snippet is truncated (defaults to empty).</p>
913
+
914
+ </td>
915
+ </tr>
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+ </tbody></table>
924
+
925
+ ## Numeric Search Parameters
926
+
927
+ <table><tbody>
928
+
929
+ <tr>
930
+ <td valign='top'>
931
+ <div class='client-readme-param-container'>
932
+ <div class='client-readme-param-container-inner'>
933
+ <div class='client-readme-param-name'><code>numericFilters</code></div>
934
+
935
+ </div>
936
+ </div>
937
+ </td>
938
+ <td class='client-readme-param-content'>
939
+ <p>A string that contains the comma separated list of numeric filters you want to apply. The filter syntax is <code>attributeName</code> followed by <code>operand</code> followed by <code>value</code>. Supported operands are <code>&lt;</code>, <code>&lt;=</code>, <code>=</code>, <code>&gt;</code> and <code>&gt;=</code>.</p>
940
+
941
+ </td>
942
+ </tr>
943
+
944
+ </tbody></table>
945
+
946
+ You can easily perform range queries via the `:` operator. This is equivalent to combining a `>=` and `<=` operand. For example, `numericFilters=price:10 to 1000`.
947
+
948
+ 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 100,price:1000 to 2000)")`.
949
+
950
+ You can also use a string array encoding (for example `numericFilters: ["price>100","price<1000"]`).
951
+
952
+ ## Category Search Parameters
953
+
954
+ <table><tbody>
955
+
956
+ <tr>
957
+ <td valign='top'>
958
+ <div class='client-readme-param-container'>
959
+ <div class='client-readme-param-container-inner'>
960
+ <div class='client-readme-param-name'><code>tagFilters</code></div>
961
+
962
+ </div>
963
+ </div>
964
+ </td>
965
+ <td class='client-readme-param-content'>
966
+ <p>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, <code>tags=tag1,(tag2,tag3)</code> means <em>tag1 AND (tag2 OR tag3)</em>. You can also use a string array encoding. For example, <code>tagFilters: [&quot;tag1&quot;,[&quot;tag2&quot;,&quot;tag3&quot;]]</code> means <em>tag1 AND (tag2 OR tag3)</em>.</p>
967
+
968
+ <p>At indexing, tags should be added in the <strong>_tags</strong> attribute of objects. For example <code>{&quot;_tags&quot;:[&quot;tag1&quot;,&quot;tag2&quot;]}</code>.</p>
969
+
970
+ </td>
971
+ </tr>
972
+
973
+ </tbody></table>
974
+
975
+ ## Faceting Parameters
976
+
977
+ <table><tbody>
978
+
979
+
980
+ <tr>
981
+ <td valign='top'>
982
+ <div class='client-readme-param-container'>
983
+ <div class='client-readme-param-container-inner'>
984
+ <div class='client-readme-param-name'><code>facetFilters</code></div>
985
+
986
+ </div>
987
+ </div>
988
+ </td>
989
+ <td class='client-readme-param-content'>
990
+ <p>Filter the query with a list of facets. Facets are separated by commas and is encoded as <code>attributeName:value</code>. To OR facets, you must add parentheses. For example: <code>facetFilters=(category:Book,category:Movie),author:John%20Doe</code>. You can also use a string array encoding. For example, <code>[[&quot;category:Book&quot;,&quot;category:Movie&quot;],&quot;author:John%20Doe&quot;]</code>.</p>
991
+
992
+ </td>
993
+ </tr>
994
+
995
+
996
+
997
+ <tr>
998
+ <td valign='top'>
999
+ <div class='client-readme-param-container'>
1000
+ <div class='client-readme-param-container-inner'>
1001
+ <div class='client-readme-param-name'><code>facets</code></div>
1002
+
1003
+ </div>
1004
+ </div>
1005
+ </td>
1006
+ <td class='client-readme-param-content'>
1007
+ <p>List of object attributes that you want to use for faceting. For each of the declared attributes, you&#39;ll be able to retrieve a list of the most relevant facet values, and their associated count for the current query.</p>
1008
+
1009
+ <p>Attributes are separated by a comma. For example, <code>&quot;category,author&quot;</code>. You can also use JSON string array encoding. For example, <code>[&quot;category&quot;,&quot;author&quot;]</code>. Only the attributes that have been added in <strong>attributesForFaceting</strong> index setting can be used in this parameter. You can also use <code>*</code> to perform faceting on all attributes specified in <code>attributesForFaceting</code>. If the number of results is important, the count can be approximate, the attribute <code>exhaustiveFacetsCount</code> in the response is true when the count is exact.</p>
1010
+
1011
+ </td>
1012
+ </tr>
1013
+
1014
+
1015
+
1016
+ <tr>
1017
+ <td valign='top'>
1018
+ <div class='client-readme-param-container'>
1019
+ <div class='client-readme-param-container-inner'>
1020
+ <div class='client-readme-param-name'><code>maxValuesPerFacet</code></div>
1021
+
1022
+ </div>
1023
+ </div>
1024
+ </td>
1025
+ <td class='client-readme-param-content'>
1026
+ <p>Limit the number of facet values returned for each facet. For example, <code>maxValuesPerFacet=10</code> will retrieve a maximum of 10 values per facet.</p>
1027
+
1028
+ </td>
1029
+ </tr>
1030
+
1031
+
1032
+ </tbody></table>
1033
+
1034
+ ## Unified Filter Parameter (SQL - like)
1035
+
1036
+ <table><tbody>
1037
+
1038
+
1039
+ <tr>
1040
+ <td valign='top'>
1041
+ <div class='client-readme-param-container'>
1042
+ <div class='client-readme-param-container-inner'>
1043
+ <div class='client-readme-param-name'><code>filters</code></div>
1044
+
1045
+ </div>
1046
+ </div>
1047
+ </td>
1048
+ <td class='client-readme-param-content'>
1049
+ <p>Filter the query with numeric, facet or/and tag filters. The syntax is a SQL like syntax, you can use the OR and AND keywords. The syntax for the underlying numeric, facet and tag filters is the same than in the other filters:
1050
+ <code>available=1 AND (category:Book OR NOT category:Ebook) AND public</code>
1051
+ <code>date: 1441745506 TO 1441755506 AND inStock &gt; 0 AND author:&quot;John Doe&quot;</code></p>
1052
+
1053
+ <p>The list of keywords is:</p>
1054
+
1055
+ <ul>
1056
+ <li><code>OR</code>: create a disjunctive filter between two filters.</li>
1057
+ <li><code>AND</code>: create a conjunctive filter between two filters.</li>
1058
+ <li><code>TO</code>: used to specify a range for a numeric filter.</li>
1059
+ <li><code>NOT</code>: used to negate a filter. The syntax with the <code>-</code> isn’t allowed.</li>
1060
+ </ul>
1061
+
1062
+ </td>
1063
+ </tr>
1064
+
1065
+ </tbody></table>
1066
+ *Note*: To specify a value with spaces or with a value equal to a keyword, it's possible to add quotes.
1067
+
1068
+ **Warning:**
1069
+
1070
+ * Like for the other filters (for performance reasons), it's not possible to have FILTER1 OR (FILTER2 AND FILTER3).
1071
+ * It's not possible to mix different categories of filters inside an OR like: num=3 OR tag1 OR facet:value
1072
+ * It's not possible to negate a group, it's only possible to negate a filter: NOT(FILTER1 OR (FILTER2) is not allowed.
1073
+
1074
+
1075
+ ## Distinct Parameter
1076
+
1077
+ <table><tbody>
1078
+
1079
+
1080
+ <tr>
1081
+ <td valign='top'>
1082
+ <div class='client-readme-param-container'>
1083
+ <div class='client-readme-param-container-inner'>
1084
+ <div class='client-readme-param-name'><code>distinct</code></div>
1085
+
1086
+ </div>
1087
+ </div>
1088
+ </td>
1089
+ <td class='client-readme-param-content'>
1090
+ <p>If set to 1, enables the distinct feature, disabled by default, if the <code>attributeForDistinct</code> index setting is set. This feature is similar to the SQL &quot;distinct&quot; keyword. When enabled in a query with the <code>distinct=1</code> parameter, all hits containing a duplicate value for the attributeForDistinct attribute are removed from results. For example, if the chosen attribute is <code>show_name</code> and several hits have the same value for <code>show_name</code>, then only the best one is kept and the others are removed.</p>
1091
+
1092
+ </td>
1093
+ </tr>
1094
+
1095
+
1096
+ </tbody></table>
1097
+
1098
+ To get a full understanding of how `Distinct` works, you can have a look at our [guide on distinct](https://www.algolia.com/doc/search/distinct).
1099
+
442
1100
 
443
1101
 
444
1102
 
445
1103
 
446
1104
  Multiple queries
447
- --------------
1105
+ ==================
448
1106
 
449
1107
  You can send multiple queries with a single API call using a batch of queries:
450
1108
 
@@ -461,14 +1119,14 @@ puts res["results"]
461
1119
 
462
1120
  The resulting JSON answer contains a ```results``` array storing the underlying queries answers. The answers order is the same than the requests order.
463
1121
 
464
- You can specify a strategy to optimize your multiple queries:
465
- - **none**: Execute the sequence of queries until the end.
466
- - **stopIfEnoughMatches**: Execute the sequence of queries until the number of hits is reached by the sum of hits.
1122
+ You can specify a `strategy` parameter to optimize your multiple queries:
1123
+ - `none`: Execute the sequence of queries until the end.
1124
+ - `stopIfEnoughMatches`: Execute the sequence of queries until the number of hits is reached by the sum of hits.
467
1125
 
468
1126
 
469
1127
 
470
1128
  Get an object
471
- -------------
1129
+ ==================
472
1130
 
473
1131
  You can easily retrieve an object using its `objectID` and optionally specify a comma separated list of attributes you want:
474
1132
 
@@ -488,7 +1146,7 @@ res = index.get_objects(["myID", "myID2"])
488
1146
  ```
489
1147
 
490
1148
  Delete an object
491
- -------------
1149
+ ==================
492
1150
 
493
1151
  You can delete an object using its `objectID`:
494
1152
 
@@ -498,7 +1156,7 @@ index.delete_object("myID")
498
1156
 
499
1157
 
500
1158
  Delete by query
501
- -------------
1159
+ ==================
502
1160
 
503
1161
  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.
504
1162
 
@@ -509,87 +1167,9 @@ index.delete_by_query("John", params)
509
1167
 
510
1168
 
511
1169
  Index Settings
512
- -------------
1170
+ ==================
513
1171
 
514
- You can retrieve all settings using the `get_settings` function. The result will contain the following attributes:
515
-
516
-
517
- #### Indexing parameters
518
- * **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:
519
- * *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.
520
- * *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)"]`.
521
- 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"]`.
522
- * **numericAttributesToIndex**: (array of strings) All numerical attributes are automatically indexed as numerical filters. If you don't need filtering on some of your numerical attributes, you can specify this list to speed up the indexing.<br/> If you only need to filter on a numeric value with the operator '=', you can speed up the indexing by specifying the attribute with `equalOnly(AttributeName)`. The other operators will be disabled.
523
- * **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.
524
- * **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.
525
- * **ranking**: (array of strings) Controls the way results are sorted.<br/>We have nine available criteria:
526
- * **typo**: Sort according to number of typos.
527
- * **geo**: Sort according to decreasing distance when performing a geo location based search.
528
- * **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.
529
- * **proximity**: Sort according to the proximity of the query words in hits.
530
- * **attribute**: Sort according to the order of attributes defined by attributesToIndex.
531
- * **exact**:
532
- * 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.
533
- * If the user query contains multiple words: sort according to the number of words that matched exactly (not as a prefix).
534
- * **custom**: Sort according to a user defined formula set in the **customRanking** attribute.
535
- * **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).
536
- * **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"].
537
- * **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)"]`.
538
- * **queryType**: Select how the query words are interpreted. It can be one of the following values:
539
- * **prefixAll**: All query words are interpreted as prefixes.
540
- * **prefixLast**: Only the last word is interpreted as a prefix (default behavior).
541
- * **prefixNone**: No query word is interpreted as a prefix. This option is not recommended.
542
- * **separatorsToIndex**: Specify the separators (punctuation characters) to index. By default, separators are not indexed. Use `+#` to be able to search Google+ or C#.
543
- * **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.
544
- * **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.
545
- * **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.
546
-
547
- #### Query expansion
548
- * **synonyms**: (array of array of string 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" ], ... ]`. Synonym feature also supports multi-words expression like `"synonyms": [ ["NY", "New York"] ]`
549
- * **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:
550
- * Push a record with the placeholder: `{ "name" : "Apple Store", "address" : "&lt;streetnumber&gt; Opera street, Paris" }`.
551
- * Configure the placeholder in your index settings: `"placeholders": { "<streetnumber>" : ["1", "2", "3", "4", "5", ... ], ... }`.
552
- * **disableTypoToleranceOnWords**: (string array) Specify a list of words on which automatic typo tolerance will be disabled.
553
- * **disableTypoToleranceOnAttributes**: (string array) List of attributes on which you want to disable typo tolerance (must be a subset of the `attributesToIndex` index setting). By default the list is empty.
554
- * **altCorrections**: (object array) Specify alternative corrections that you want to consider. Each alternative correction is described by an object containing three attributes:
555
- * **word**: The word to correct.
556
- * **correction**: The corrected word.
557
- * **nbTypos** The number of typos (1 or 2) that will be considered for the ranking algorithm (1 typo is better than 2 typos).
558
-
559
- For example `"altCorrections": [ { "word" : "foot", "correction": "feet", "nbTypos": 1 }, { "word": "feet", "correction": "foot", "nbTypos": 1 } ]`.
560
-
561
- #### Default query parameters (can be overwritten by queries)
562
- * **minWordSizefor1Typo**: (integer) The minimum number of characters needed to accept one typo (default = 4).
563
- * **minWordSizefor2Typos**: (integer) The minimum number of characters needed to accept two typos (default = 8).
564
- * **hitsPerPage**: (integer) The number of hits per page (default = 10).
565
- * **attributesToRetrieve**: (array of strings) Default list of attributes to retrieve in objects. If set to null, all attributes are retrieved.
566
- * **attributesToHighlight**: (array of strings) Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
567
- * **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.
568
- * **highlightPreTag**: (string) Specify the string that is inserted before the highlighted parts in the query result (defaults to "&lt;em&gt;").
569
- * **highlightPostTag**: (string) Specify the string that is inserted after the highlighted parts in the query result (defaults to "&lt;/em&gt;").
570
- * **optionalWords**: (array of strings) Specify a list of words that should be considered optional when found in the query.
571
- * **allowTyposOnNumericTokens**: (boolean) If set to false, disable typo-tolerance on numeric tokens (=numbers) in the query word. For example the query `"304"` will match with `"30450"`, but not with `"40450"` that would have been the case with typo-tolerance enabled. Can be very useful on serial numbers and zip codes searches. Default to false.
572
- * **ignorePlurals**: (boolean) If set to true, simple plural forms won’t be considered as typos (for example car/cars will be considered as equal). Default to false.
573
- * **advancedSyntax**: Enable the advanced query syntax. Defaults to 0 (false).
574
-
575
- * **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.
576
-
577
- * **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`.
578
- * **replaceSynonymsInHighlight**: (boolean) If set to false, words matched via synonyms expansion will not be replaced by the matched synonym in the highlighted result. Default to true.
579
- * **maxValuesPerFacet**: (integer) Limit the number of facet values returned for each facet. For example: `maxValuesPerFacet=10` will retrieve max 10 values per facet.
580
- * **distinct**: (integer) 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.
581
- * **typoTolerance**: (string) This setting has four different options:
582
-
583
- * **true:** activate the typo-tolerance (default value).
584
-
585
- * **false:** disable the typo-tolerance
586
-
587
- * **min:** keep only results with the lowest number of typo. For example if one result match without typos, then all results with typos will be hidden.
588
-
589
- * **strict:** if there is a match without typo, then all results with 2 typos or more will be removed. This option is useful if you want to avoid as much as possible false positive.
590
- * **removeStopWords**: (boolean) Remove stop words from query before executing it. Defaults to false. Contains stop words for 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu)
591
-
592
- You can easily retrieve settings or update them:
1172
+ You can easily retrieve or update settings:
593
1173
 
594
1174
  ```ruby
595
1175
  res = index.get_settings
@@ -600,16 +1180,632 @@ puts settings.to_json
600
1180
  index.set_settings({"customRanking" => ["desc(followers)"]})
601
1181
  ```
602
1182
 
1183
+
1184
+ ## Indexing parameters
1185
+
1186
+ <table><tbody>
1187
+
1188
+
1189
+ <tr>
1190
+ <td valign='top'>
1191
+ <div class='client-readme-param-container'>
1192
+ <div class='client-readme-param-container-inner'>
1193
+ <div class='client-readme-param-name'><code>attributesToIndex</code></div>
1194
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1195
+ </div>
1196
+ </div>
1197
+ </td>
1198
+ <td class='client-readme-param-content'>
1199
+ <p>The list of attributes you want index (i.e. to make searchable).</p>
1200
+
1201
+ <p>If set to null, all textual and numerical attributes of your objects are indexed. Make sure you updated this setting to get optimal results.</p>
1202
+
1203
+ <p>This parameter has two important uses:</p>
1204
+
1205
+ <ul>
1206
+ <li><em>Limit the attributes to index</em>.<br/>For example, if you store the URL of a picture, you want to store it and be able to retrieve it, but you probably don&#39;t want to search in the URL.</li>
1207
+ <li><em>Control part of the ranking</em>.<br/> 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 <code>unordered(AttributeName)</code>. For example, <code>attributesToIndex: [&quot;title&quot;, &quot;unordered(text)&quot;]</code>.
1208
+ 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 <code>title</code> and <code>alternative_title</code> have the same priority in this example, which is different than text priority: <code>attributesToIndex:[&quot;title,alternative_title&quot;, &quot;text&quot;]</code>.
1209
+ To get a full description of how the Ranking works, you can have a look at our <a href="https://www.algolia.com/doc/relevance/ranking">Ranking guide</a>.</li>
1210
+ <li><strong>numericAttributesToIndex</strong>: (array of strings) All numerical attributes are automatically indexed as numerical filters (allowing filtering operations like <code>&lt;</code> and <code>&lt;=</code>). If you don&#39;t need filtering on some of your numerical attributes, you can specify this list to speed up the indexing.<br/> If you only need to filter on a numeric value with the operator &#39;=&#39;, you can speed up the indexing by specifying the attribute with <code>equalOnly(AttributeName)</code>. The other operators will be disabled.</li>
1211
+ </ul>
1212
+
1213
+ </td>
1214
+ </tr>
1215
+
1216
+
1217
+
1218
+ <tr>
1219
+ <td valign='top'>
1220
+ <div class='client-readme-param-container'>
1221
+ <div class='client-readme-param-container-inner'>
1222
+ <div class='client-readme-param-name'><code>attributesForFaceting</code></div>
1223
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1224
+ </div>
1225
+ </div>
1226
+ </td>
1227
+ <td class='client-readme-param-content'>
1228
+ <p>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.</p>
1229
+
1230
+ </td>
1231
+ </tr>
1232
+
1233
+
1234
+
1235
+ <tr>
1236
+ <td valign='top'>
1237
+ <div class='client-readme-param-container'>
1238
+ <div class='client-readme-param-container-inner'>
1239
+ <div class='client-readme-param-name'><code>attributeForDistinct</code></div>
1240
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div></div>
1241
+ </div>
1242
+ </div>
1243
+ </td>
1244
+ <td class='client-readme-param-content'>
1245
+ <p>The name of the attribute used for the <code>Distinct</code> feature. This feature is similar to the SQL &quot;distinct&quot; keyword. When enabled in queries with the <code>distinct=1</code> parameter, all hits containing a duplicate value for this attribute are removed from the results. For example, if the chosen attribute is <code>show_name</code> and several hits have the same value for <code>show_name</code>, then only the first one is kept and the others are removed from the results. To get a full understanding of how <code>Distinct</code> works, you can have a look at our <a href="https://www.algolia.com/doc/search/distinct">guide on distinct</a>.</p>
1246
+
1247
+ </td>
1248
+ </tr>
1249
+
1250
+
1251
+
1252
+ <tr>
1253
+ <td valign='top'>
1254
+ <div class='client-readme-param-container'>
1255
+ <div class='client-readme-param-container-inner'>
1256
+ <div class='client-readme-param-name'><code>ranking</code></div>
1257
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1258
+ </div>
1259
+ </div>
1260
+ </td>
1261
+ <td class='client-readme-param-content'>
1262
+ <p>Controls the way results are sorted.</p>
1263
+
1264
+ <p>We have nine available criteria:</p>
1265
+
1266
+ <ul>
1267
+ <li><code>typo</code>: Sort according to number of typos.</li>
1268
+ <li><code>geo</code>: Sort according to decreasing distance when performing a geo location based search.</li>
1269
+ <li><code>words</code>: Sort according to the number of query words matched by decreasing order. This parameter is useful when you use the <code>optionalWords</code> query parameter to have results with the most matched words first.</li>
1270
+ <li><code>proximity</code>: Sort according to the proximity of the query words in hits.</li>
1271
+ <li><code>attribute</code>: Sort according to the order of attributes defined by attributesToIndex.</li>
1272
+ <li><code>exact</code>:
1273
+
1274
+ <ul>
1275
+ <li>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 &quot;V&quot;, you want to find it with the &quot;V&quot; query and avoid getting all popular TV shows starting by the letter V before it.</li>
1276
+ <li>If the user query contains multiple words: sort according to the number of words that matched exactly (not as a prefix).</li>
1277
+ </ul></li>
1278
+ <li><code>custom</code>: Sort according to a user defined formula set in the <code>customRanking</code> attribute.</li>
1279
+ <li><code>asc(attributeName)</code>: Sort according to a numeric attribute using ascending order. <code>attributeName</code> can be the name of any numeric attribute in your records (integer, double or boolean).</li>
1280
+ <li><code>desc(attributeName)</code>: Sort according to a numeric attribute using descending order. <code>attributeName</code> can be the name of any numeric attribute in your records (integer, double or boolean). <br/>The standard order is <code>[&quot;typo&quot;, &quot;geo&quot;, &quot;words&quot;, &quot;proximity&quot;, &quot;attribute&quot;, &quot;exact&quot;, &quot;custom&quot;]</code>.
1281
+ To get a full description of how the Ranking works, you can have a look at our <a href="https://www.algolia.com/doc/relevance/ranking">Ranking guide</a>.</li>
1282
+ </ul>
1283
+
1284
+ </td>
1285
+ </tr>
1286
+
1287
+
1288
+
1289
+ <tr>
1290
+ <td valign='top'>
1291
+ <div class='client-readme-param-container'>
1292
+ <div class='client-readme-param-container-inner'>
1293
+ <div class='client-readme-param-name'><code>customRanking</code></div>
1294
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1295
+ </div>
1296
+ </div>
1297
+ </td>
1298
+ <td class='client-readme-param-content'>
1299
+ <p>Lets you specify part of the ranking.</p>
1300
+
1301
+ <p>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, <code>&quot;customRanking&quot; =&gt; [&quot;desc(population)&quot;, &quot;asc(name)&quot;]</code>.</p>
1302
+
1303
+ <p>To get a full description of how the Custom Ranking works, you can have a look at our <a href="https://www.algolia.com/doc/relevance/ranking">Ranking guide</a>.</p>
1304
+
1305
+ </td>
1306
+ </tr>
1307
+
1308
+
1309
+
1310
+ <tr>
1311
+ <td valign='top'>
1312
+ <div class='client-readme-param-container'>
1313
+ <div class='client-readme-param-container-inner'>
1314
+ <div class='client-readme-param-name'><code>queryType</code></div>
1315
+ <div class="client-readme-param-meta"><div><em>Default: <strong>prefixLast</strong></em></div></div>
1316
+ </div>
1317
+ </div>
1318
+ </td>
1319
+ <td class='client-readme-param-content'>
1320
+ <p>Select how the query words are interpreted. It can be one of the following values:</p>
1321
+
1322
+ <ul>
1323
+ <li><code>prefixAll</code>: All query words are interpreted as prefixes.</li>
1324
+ <li><code>prefixLast</code>: Only the last word is interpreted as a prefix (default behavior).</li>
1325
+ <li><code>prefixNone</code>: No query word is interpreted as a prefix. This option is not recommended.</li>
1326
+ </ul>
1327
+
1328
+ </td>
1329
+ </tr>
1330
+
1331
+
1332
+
1333
+ <tr>
1334
+ <td valign='top'>
1335
+ <div class='client-readme-param-container'>
1336
+ <div class='client-readme-param-container-inner'>
1337
+ <div class='client-readme-param-name'><code>separatorsToIndex</code></div>
1338
+ <div class="client-readme-param-meta"><div><em>Default: <strong>empty</strong></em></div></div>
1339
+ </div>
1340
+ </div>
1341
+ </td>
1342
+ <td class='client-readme-param-content'>
1343
+ <p>Specify the separators (punctuation characters) to index. By default, separators are not indexed. Use <code>+#</code> to be able to search Google+ or C#.</p>
1344
+
1345
+ </td>
1346
+ </tr>
1347
+
1348
+
1349
+
1350
+ <tr>
1351
+ <td valign='top'>
1352
+ <div class='client-readme-param-container'>
1353
+ <div class='client-readme-param-container-inner'>
1354
+ <div class='client-readme-param-name'><code>slaves</code></div>
1355
+
1356
+ </div>
1357
+ </div>
1358
+ </td>
1359
+ <td class='client-readme-param-content'>
1360
+ <p>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.</p>
1361
+
1362
+ </td>
1363
+ </tr>
1364
+
1365
+
1366
+
1367
+ <tr>
1368
+ <td valign='top'>
1369
+ <div class='client-readme-param-container'>
1370
+ <div class='client-readme-param-container-inner'>
1371
+ <div class='client-readme-param-name'><code>unretrievableAttributes</code></div>
1372
+ <div class="client-readme-param-meta"><div><em>Default: <strong>empty</strong></em></div></div>
1373
+ </div>
1374
+ </div>
1375
+ </td>
1376
+ <td class='client-readme-param-content'>
1377
+ <p>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. Warning: for testing purposes, this setting is ignored when you&#39;re using the ADMIN API Key.</p>
1378
+
1379
+ </td>
1380
+ </tr>
1381
+
1382
+
1383
+
1384
+ <tr>
1385
+ <td valign='top'>
1386
+ <div class='client-readme-param-container'>
1387
+ <div class='client-readme-param-container-inner'>
1388
+ <div class='client-readme-param-name'><code>allowCompressionOfIntegerArray</code></div>
1389
+ <div class="client-readme-param-meta"><div><em>Default: <strong>false</strong></em></div></div>
1390
+ </div>
1391
+ </div>
1392
+ </td>
1393
+ <td class='client-readme-param-content'>
1394
+ <p>Allows compression of big integer arrays. In data-intensive use-cases, 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.</p>
1395
+
1396
+ </td>
1397
+ </tr>
1398
+
1399
+
1400
+ </tbody></table>
1401
+
1402
+ ## Query expansion
1403
+
1404
+ <table><tbody>
1405
+
1406
+ <tr>
1407
+ <td valign='top'>
1408
+ <div class='client-readme-param-container'>
1409
+ <div class='client-readme-param-container-inner'>
1410
+ <div class='client-readme-param-name'><code>synonyms</code></div>
1411
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of array of string considered as equals</strong></em></div></div>
1412
+ </div>
1413
+ </div>
1414
+ </td>
1415
+ <td class='client-readme-param-content'>
1416
+ <p>For example, you may want to retrieve the <strong>black ipad</strong> record when your users are searching for <strong>dark ipad</strong>, even if the word <strong>dark</strong> is not part of the record. To do this, you need to configure <strong>black</strong> as a synonym of <strong>dark</strong>. For example, <code>&quot;synomyms&quot;: [ [ &quot;black&quot;, &quot;dark&quot; ], [ &quot;small&quot;, &quot;little&quot;, &quot;mini&quot; ], ... ]</code>. The Synonym feature also supports multi-words expressions like <code>&quot;synonyms&quot;: [ [&quot;NYC&quot;, &quot;New York City&quot;] ]</code></p>
1417
+
1418
+ </td>
1419
+ </tr>
1420
+
1421
+
1422
+ <tr>
1423
+ <td valign='top'>
1424
+ <div class='client-readme-param-container'>
1425
+ <div class='client-readme-param-container-inner'>
1426
+ <div class='client-readme-param-name'><code>placeholders</code></div>
1427
+ <div class="client-readme-param-meta"><div><em>Type: <strong>hash of array of words</strong></em></div></div>
1428
+ </div>
1429
+ </div>
1430
+ </td>
1431
+ <td class='client-readme-param-content'>
1432
+ <p>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, <code>&quot;placeholders&quot;: { &quot;&lt;streetnumber&gt;&quot;: [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, ..., &quot;9999&quot;]}</code> would allow it to be able to match all street numbers. We use the <code>&lt; &gt;</code> tag syntax to define placeholders in an attribute. For example:</p>
1433
+
1434
+ <ul>
1435
+ <li>Push a record with the placeholder: <code>{ &quot;name&quot; : &quot;Apple Store&quot;, &quot;address&quot; : &quot;&amp;lt;streetnumber&amp;gt; Opera street, Paris&quot; }</code>.</li>
1436
+ <li>Configure the placeholder in your index settings: <code>&quot;placeholders&quot;: { &quot;&lt;streetnumber&gt;&quot; : [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, ... ], ... }</code>.</li>
1437
+ </ul>
1438
+
1439
+ </td>
1440
+ </tr>
1441
+
1442
+
1443
+ <tr>
1444
+ <td valign='top'>
1445
+ <div class='client-readme-param-container'>
1446
+ <div class='client-readme-param-container-inner'>
1447
+ <div class='client-readme-param-name'><code>disableTypoToleranceOnWords</code></div>
1448
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1449
+ </div>
1450
+ </div>
1451
+ </td>
1452
+ <td class='client-readme-param-content'>
1453
+ <p>Specify a list of words on which automatic typo tolerance will be disabled.</p>
1454
+
1455
+ </td>
1456
+ </tr>
1457
+
1458
+
1459
+ <tr>
1460
+ <td valign='top'>
1461
+ <div class='client-readme-param-container'>
1462
+ <div class='client-readme-param-container-inner'>
1463
+ <div class='client-readme-param-name'><code>disableTypoToleranceOnAttributes</code></div>
1464
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1465
+ </div>
1466
+ </div>
1467
+ </td>
1468
+ <td class='client-readme-param-content'>
1469
+ <p>List of attributes on which you want to disable typo tolerance (must be a subset of the <code>attributesToIndex</code> index setting). By default the list is empty.</p>
1470
+
1471
+ </td>
1472
+ </tr>
1473
+
1474
+
1475
+ <tr>
1476
+ <td valign='top'>
1477
+ <div class='client-readme-param-container'>
1478
+ <div class='client-readme-param-container-inner'>
1479
+ <div class='client-readme-param-name'><code>altCorrections</code></div>
1480
+ <div class="client-readme-param-meta"><div><em>Type: <strong>object array</strong></em></div></div>
1481
+ </div>
1482
+ </div>
1483
+ </td>
1484
+ <td class='client-readme-param-content'>
1485
+ <p>Specify alternative corrections that you want to consider. Each alternative correction is described by an object containing three attributes:</p>
1486
+
1487
+ <ul>
1488
+ <li><strong>word</strong>: The word to correct.</li>
1489
+ <li><strong>correction</strong>: The corrected word.</li>
1490
+ <li><strong>nbTypos</strong> The number of typos (1 or 2) that will be considered for the ranking algorithm (1 typo is better than 2 typos).</li>
1491
+ </ul>
1492
+
1493
+ <p>For example <code>&quot;altCorrections&quot;: [ { &quot;word&quot; : &quot;foot&quot;, &quot;correction&quot;: &quot;feet&quot;, &quot;nbTypos&quot;: 1 }, { &quot;word&quot;: &quot;feet&quot;, &quot;correction&quot;: &quot;foot&quot;, &quot;nbTypos&quot;: 1 } ]</code>.</p>
1494
+
1495
+ </td>
1496
+ </tr>
1497
+
1498
+
1499
+ </tbody></table>
1500
+
1501
+ ## Default query parameters (can be overwritten by queries)
1502
+
1503
+ <table><tbody>
1504
+
1505
+ <tr>
1506
+ <td valign='top'>
1507
+ <div class='client-readme-param-container'>
1508
+ <div class='client-readme-param-container-inner'>
1509
+ <div class='client-readme-param-name'><code>minWordSizefor1Typo</code></div>
1510
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div><div><em>Default: <strong>4</strong></em></div></div>
1511
+ </div>
1512
+ </div>
1513
+ </td>
1514
+ <td class='client-readme-param-content'>
1515
+ <p>The minimum number of characters needed to accept one typo (default = 4).</p>
1516
+
1517
+ </td>
1518
+ </tr>
1519
+
1520
+
1521
+ <tr>
1522
+ <td valign='top'>
1523
+ <div class='client-readme-param-container'>
1524
+ <div class='client-readme-param-container-inner'>
1525
+ <div class='client-readme-param-name'><code>minWordSizefor2Typos</code></div>
1526
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div><div><em>Default: <strong>8</strong></em></div></div>
1527
+ </div>
1528
+ </div>
1529
+ </td>
1530
+ <td class='client-readme-param-content'>
1531
+ <p>The minimum number of characters needed to accept two typos (default = 8).</p>
1532
+
1533
+ </td>
1534
+ </tr>
1535
+
1536
+
1537
+ <tr>
1538
+ <td valign='top'>
1539
+ <div class='client-readme-param-container'>
1540
+ <div class='client-readme-param-container-inner'>
1541
+ <div class='client-readme-param-name'><code>hitsPerPage</code></div>
1542
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div><div><em>Default: <strong>10</strong></em></div></div>
1543
+ </div>
1544
+ </div>
1545
+ </td>
1546
+ <td class='client-readme-param-content'>
1547
+ <p>The number of hits per page (default = 10).</p>
1548
+
1549
+ </td>
1550
+ </tr>
1551
+
1552
+
1553
+ <tr>
1554
+ <td valign='top'>
1555
+ <div class='client-readme-param-container'>
1556
+ <div class='client-readme-param-container-inner'>
1557
+ <div class='client-readme-param-name'><code>attributesToRetrieve</code></div>
1558
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1559
+ </div>
1560
+ </div>
1561
+ </td>
1562
+ <td class='client-readme-param-content'>
1563
+ <p>Default list of attributes to retrieve in objects. If set to null, all attributes are retrieved.</p>
1564
+
1565
+ </td>
1566
+ </tr>
1567
+
1568
+
1569
+ <tr>
1570
+ <td valign='top'>
1571
+ <div class='client-readme-param-container'>
1572
+ <div class='client-readme-param-container-inner'>
1573
+ <div class='client-readme-param-name'><code>attributesToHighlight</code></div>
1574
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1575
+ </div>
1576
+ </div>
1577
+ </td>
1578
+ <td class='client-readme-param-content'>
1579
+ <p>Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.</p>
1580
+
1581
+ </td>
1582
+ </tr>
1583
+
1584
+
1585
+ <tr>
1586
+ <td valign='top'>
1587
+ <div class='client-readme-param-container'>
1588
+ <div class='client-readme-param-container-inner'>
1589
+ <div class='client-readme-param-name'><code>attributesToSnippet</code></div>
1590
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1591
+ </div>
1592
+ </div>
1593
+ </td>
1594
+ <td class='client-readme-param-content'>
1595
+ <p>Default list of attributes to snippet alongside the number of words to return (syntax is <code>attributeName:nbWords</code>).<br/>By default, no snippet is computed. If set to null, no snippet is computed.</p>
1596
+
1597
+ </td>
1598
+ </tr>
1599
+
1600
+
1601
+ <tr>
1602
+ <td valign='top'>
1603
+ <div class='client-readme-param-container'>
1604
+ <div class='client-readme-param-container-inner'>
1605
+ <div class='client-readme-param-name'><code>highlightPreTag</code></div>
1606
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div></div>
1607
+ </div>
1608
+ </div>
1609
+ </td>
1610
+ <td class='client-readme-param-content'>
1611
+ <p>Specify the string that is inserted before the highlighted parts in the query result (defaults to <code>&lt;em&gt;</code>).</p>
1612
+
1613
+ </td>
1614
+ </tr>
1615
+
1616
+
1617
+ <tr>
1618
+ <td valign='top'>
1619
+ <div class='client-readme-param-container'>
1620
+ <div class='client-readme-param-container-inner'>
1621
+ <div class='client-readme-param-name'><code>highlightPostTag</code></div>
1622
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div></div>
1623
+ </div>
1624
+ </div>
1625
+ </td>
1626
+ <td class='client-readme-param-content'>
1627
+ <p>Specify the string that is inserted after the highlighted parts in the query result (defaults to <code>&lt;/em&gt;</code>).</p>
1628
+
1629
+ </td>
1630
+ </tr>
1631
+
1632
+
1633
+ <tr>
1634
+ <td valign='top'>
1635
+ <div class='client-readme-param-container'>
1636
+ <div class='client-readme-param-container-inner'>
1637
+ <div class='client-readme-param-name'><code>optionalWords</code></div>
1638
+ <div class="client-readme-param-meta"><div><em>Type: <strong>array of strings</strong></em></div></div>
1639
+ </div>
1640
+ </div>
1641
+ </td>
1642
+ <td class='client-readme-param-content'>
1643
+ <p>Specify a list of words that should be considered optional when found in the query.</p>
1644
+
1645
+ </td>
1646
+ </tr>
1647
+
1648
+
1649
+ <tr>
1650
+ <td valign='top'>
1651
+ <div class='client-readme-param-container'>
1652
+ <div class='client-readme-param-container-inner'>
1653
+ <div class='client-readme-param-name'><code>allowTyposOnNumericTokens</code></div>
1654
+ <div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1655
+ </div>
1656
+ </div>
1657
+ </td>
1658
+ <td class='client-readme-param-content'>
1659
+ <p>If set to false, disable typo-tolerance on numeric tokens (=numbers) in the query word. For example the query <code>&quot;304&quot;</code> will match with <code>&quot;30450&quot;</code>, but not with <code>&quot;40450&quot;</code> that would have been the case with typo-tolerance enabled. Can be very useful on serial numbers and zip codes searches. Defaults to false.</p>
1660
+
1661
+ </td>
1662
+ </tr>
1663
+
1664
+
1665
+ <tr>
1666
+ <td valign='top'>
1667
+ <div class='client-readme-param-container'>
1668
+ <div class='client-readme-param-container-inner'>
1669
+ <div class='client-readme-param-name'><code>ignorePlurals</code></div>
1670
+ <div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1671
+ </div>
1672
+ </div>
1673
+ </td>
1674
+ <td class='client-readme-param-content'>
1675
+ <p>If set to true, singular/plural forms won’t be considered as typos (for example car/cars and foot/feet will be considered as equivalent). Defaults to false.</p>
1676
+
1677
+ </td>
1678
+ </tr>
1679
+
1680
+
1681
+ <tr>
1682
+ <td valign='top'>
1683
+ <div class='client-readme-param-container'>
1684
+ <div class='client-readme-param-container-inner'>
1685
+ <div class='client-readme-param-name'><code>advancedSyntax</code></div>
1686
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer (0 or 1)</strong></em></div><div><em>Default: <strong>0</strong></em></div></div>
1687
+ </div>
1688
+ </div>
1689
+ </td>
1690
+ <td class='client-readme-param-content'>
1691
+ <p>Enable the advanced query syntax. Defaults to 0 (false).</p>
1692
+
1693
+ <ul>
1694
+ <li><p><strong>Phrase query:</strong> a phrase query defines a particular sequence of terms. A phrase query is build by Algolia&#39;s query parser for words surrounded by <code>&quot;</code>. For example, <code>&quot;search engine&quot;</code> will retrieve records having <code>search</code> next to <code>engine</code> only. Typo-tolerance is disabled on phrase queries.</p></li>
1695
+ <li><p><strong>Prohibit operator:</strong> The prohibit operator excludes records that contain the term after the <code>-</code> symbol. For example <code>search -engine</code> will retrieve records containing <code>search</code> but not <code>engine</code>.</p></li>
1696
+ </ul>
1697
+
1698
+ </td>
1699
+ </tr>
1700
+
1701
+
1702
+ <tr>
1703
+ <td valign='top'>
1704
+ <div class='client-readme-param-container'>
1705
+ <div class='client-readme-param-container-inner'>
1706
+ <div class='client-readme-param-name'><code>replaceSynonymsInHighlight</code></div>
1707
+ <div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>true</strong></em></div></div>
1708
+ </div>
1709
+ </div>
1710
+ </td>
1711
+ <td class='client-readme-param-content'>
1712
+ <p>If set to false, words matched via synonyms expansion will not be replaced by the matched synonym in the highlighted result. Defaults to true.</p>
1713
+
1714
+ </td>
1715
+ </tr>
1716
+
1717
+
1718
+ <tr>
1719
+ <td valign='top'>
1720
+ <div class='client-readme-param-container'>
1721
+ <div class='client-readme-param-container-inner'>
1722
+ <div class='client-readme-param-name'><code>maxValuesPerFacet</code></div>
1723
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer</strong></em></div></div>
1724
+ </div>
1725
+ </div>
1726
+ </td>
1727
+ <td class='client-readme-param-content'>
1728
+ <p>Limit the number of facet values returned for each facet. For example: <code>maxValuesPerFacet=10</code> will retrieve max 10 values per facet.</p>
1729
+
1730
+ </td>
1731
+ </tr>
1732
+
1733
+
1734
+ <tr>
1735
+ <td valign='top'>
1736
+ <div class='client-readme-param-container'>
1737
+ <div class='client-readme-param-container-inner'>
1738
+ <div class='client-readme-param-name'><code>distinct</code></div>
1739
+ <div class="client-readme-param-meta"><div><em>Type: <strong>integer (0 or 1)</strong></em></div><div><em>Default: <strong>0</strong></em></div></div>
1740
+ </div>
1741
+ </div>
1742
+ </td>
1743
+ <td class='client-readme-param-content'>
1744
+ <p>Enable the distinct feature (disabled by default) if the <code>attributeForDistinct</code> index setting is set. This feature is similar to the SQL &quot;distinct&quot; keyword: when enabled in a query with the <code>distinct=1</code> parameter, all hits containing a duplicate value for the<code>attributeForDistinct</code> attribute are removed from results. For example, if the chosen attribute is <code>show_name</code> and several hits have the same value for <code>show_name</code>, then only the best one is kept and others are removed.</p>
1745
+
1746
+ <p>To get a full understanding of how <code>Distinct</code> works, you can have a look at our <a href="https://www.algolia.com/doc/search/distinct">guide on distinct</a>.</p>
1747
+
1748
+ </td>
1749
+ </tr>
1750
+
1751
+
1752
+ <tr>
1753
+ <td valign='top'>
1754
+ <div class='client-readme-param-container'>
1755
+ <div class='client-readme-param-container-inner'>
1756
+ <div class='client-readme-param-name'><code>typoTolerance</code></div>
1757
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>true</strong></em></div></div>
1758
+ </div>
1759
+ </div>
1760
+ </td>
1761
+ <td class='client-readme-param-content'>
1762
+ <p>This setting has four different options:</p>
1763
+
1764
+ <ul>
1765
+ <li><p><code>true:</code> activate the typo-tolerance (default value).</p></li>
1766
+ <li><p><code>false:</code> disable the typo-tolerance</p></li>
1767
+ <li><p><code>min:</code> keep only results with the lowest number of typos. For example if one result matches without typos, then all results with typos will be hidden.</p></li>
1768
+ <li><p><code>strict:</code> if there is a match without typo, then all results with 2 typos or more will be removed.</p></li>
1769
+ </ul>
1770
+
1771
+ </td>
1772
+ </tr>
1773
+
1774
+
1775
+ <tr>
1776
+ <td valign='top'>
1777
+ <div class='client-readme-param-container'>
1778
+ <div class='client-readme-param-container-inner'>
1779
+ <div class='client-readme-param-name'><code>removeStopWords</code></div>
1780
+ <div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1781
+ </div>
1782
+ </div>
1783
+ </td>
1784
+ <td class='client-readme-param-content'>
1785
+ <p>Remove stop words from query before executing it. Defaults to false. Contains stop words for 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu)</p>
1786
+
1787
+ </td>
1788
+ </tr>
1789
+
1790
+ </tbody></table>
1791
+
1792
+
1793
+
1794
+
603
1795
  List indices
604
- -------------
1796
+ ==================
605
1797
  You can list all your indices along with their associated information (number of entries, disk size, etc.) with the `list_indexes` method:
606
1798
 
607
1799
  ```ruby
608
1800
  Algolia.list_indexes
609
1801
  ```
610
1802
 
1803
+
1804
+
1805
+
1806
+
611
1807
  Delete an index
612
- -------------
1808
+ ==================
613
1809
  You can delete an index using its name:
614
1810
 
615
1811
  ```ruby
@@ -617,8 +1813,12 @@ index = Algolia::Index.new("contacts")
617
1813
  index.delete_index
618
1814
  ```
619
1815
 
1816
+
1817
+
1818
+
1819
+
620
1820
  Clear an index
621
- -------------
1821
+ ==================
622
1822
  You can delete the index contents without removing settings and index specific API keys by using the clearIndex command:
623
1823
 
624
1824
  ```ruby
@@ -626,7 +1826,7 @@ index.clear_index
626
1826
  ```
627
1827
 
628
1828
  Wait indexing
629
- -------------
1829
+ ==================
630
1830
 
631
1831
  All write operations in Algolia are asynchronous by design.
632
1832
 
@@ -648,7 +1848,7 @@ If you want to ensure multiple objects have been indexed, you only need to check
648
1848
  the biggest `taskID` with `wait_task`.
649
1849
 
650
1850
  Batch writes
651
- -------------
1851
+ ==================
652
1852
 
653
1853
  You may want to perform multiple operations with one API call to reduce latency.
654
1854
  We expose four methods to perform batch operations:
@@ -708,9 +1908,9 @@ The attribute **action** can have these values:
708
1908
  - deleteObject
709
1909
 
710
1910
  Security / User API Keys
711
- -------------
1911
+ ==================
712
1912
 
713
- The admin API key provides full control of all your indices.
1913
+ The ADMIN API key provides full control of all your indices.
714
1914
  You can also generate user API keys to control security.
715
1915
  These API keys can be restricted to a set of operations or/and restricted to a given index.
716
1916
 
@@ -745,18 +1945,123 @@ puts res['key']
745
1945
 
746
1946
  You can also create an API Key with advanced settings:
747
1947
 
748
- * **validity**: Add a validity period. The key will be valid for a specific period of time (in seconds).
749
- * **maxQueriesPerIPPerHour**: 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.
750
-
751
-
752
- 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.
753
-
754
- * **maxHitsPerQuery**: 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.
755
- * **indexes**: 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.
756
- * **referers**: Specify the list of referers. You can target all referers starting with a prefix or ending with a suffix using the '\*' character. For example, "algolia.com/\*" matches all referers starting with "algolia.com/" and "\*.algolia.com" matches all referers ending with ".algolia.com". Defaults to all referers if empty or blank.
757
- * **queryParameters**: Specify the list of query parameters. You can force the query parameters for a query using the url string format (param1=X&param2=Y...).
758
- * **description**: Specify a description to describe where the key is used.
759
-
1948
+ <table><tbody>
1949
+
1950
+ <tr>
1951
+ <td valign='top'>
1952
+ <div class='client-readme-param-container'>
1953
+ <div class='client-readme-param-container-inner'>
1954
+ <div class='client-readme-param-name'><code>validity</code></div>
1955
+
1956
+ </div>
1957
+ </div>
1958
+ </td>
1959
+ <td class='client-readme-param-content'>
1960
+ <p>Add a validity period. The key will be valid for a specific period of time (in seconds).</p>
1961
+
1962
+ </td>
1963
+ </tr>
1964
+
1965
+
1966
+ <tr>
1967
+ <td valign='top'>
1968
+ <div class='client-readme-param-container'>
1969
+ <div class='client-readme-param-container-inner'>
1970
+ <div class='client-readme-param-name'><code>maxQueriesPerIPPerHour</code></div>
1971
+
1972
+ </div>
1973
+ </div>
1974
+ </td>
1975
+ <td class='client-readme-param-content'>
1976
+ <p>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.</p>
1977
+
1978
+ <p>Note: If you are sending the query through your servers, you must use the <code>Algolia.with_rate_limits(&quot;EndUserIP&quot;, &quot;APIKeyWithRateLimit&quot;) do ... end</code> block to enable rate-limit.</p>
1979
+
1980
+ </td>
1981
+ </tr>
1982
+
1983
+
1984
+ <tr>
1985
+ <td valign='top'>
1986
+ <div class='client-readme-param-container'>
1987
+ <div class='client-readme-param-container-inner'>
1988
+ <div class='client-readme-param-name'><code>maxHitsPerQuery</code></div>
1989
+
1990
+ </div>
1991
+ </div>
1992
+ </td>
1993
+ <td class='client-readme-param-content'>
1994
+ <p>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.</p>
1995
+
1996
+ </td>
1997
+ </tr>
1998
+
1999
+
2000
+ <tr>
2001
+ <td valign='top'>
2002
+ <div class='client-readme-param-container'>
2003
+ <div class='client-readme-param-container-inner'>
2004
+ <div class='client-readme-param-name'><code>indexes</code></div>
2005
+
2006
+ </div>
2007
+ </div>
2008
+ </td>
2009
+ <td class='client-readme-param-content'>
2010
+ <p>Specify the list of targeted indices. You can target all indices starting with a prefix or ending with a suffix using the &#39;*&#39; character. For example, &quot;dev_*&quot; matches all indices starting with &quot;dev_&quot; and &quot;*_dev&quot; matches all indices ending with &quot;_dev&quot;. Defaults to all indices if empty or blank.</p>
2011
+
2012
+ </td>
2013
+ </tr>
2014
+
2015
+
2016
+ <tr>
2017
+ <td valign='top'>
2018
+ <div class='client-readme-param-container'>
2019
+ <div class='client-readme-param-container-inner'>
2020
+ <div class='client-readme-param-name'><code>referers</code></div>
2021
+
2022
+ </div>
2023
+ </div>
2024
+ </td>
2025
+ <td class='client-readme-param-content'>
2026
+ <p>Specify the list of referers. You can target all referers starting with a prefix or ending with a suffix using the &#39;*&#39; character. For example, &quot;algolia.com/*&quot; matches all referers starting with &quot;algolia.com/&quot; and &quot;*.algolia.com&quot; matches all referers ending with &quot;.algolia.com&quot;. Defaults to all referers if empty or blank.</p>
2027
+
2028
+ </td>
2029
+ </tr>
2030
+
2031
+
2032
+ <tr>
2033
+ <td valign='top'>
2034
+ <div class='client-readme-param-container'>
2035
+ <div class='client-readme-param-container-inner'>
2036
+ <div class='client-readme-param-name'><code>queryParameters</code></div>
2037
+
2038
+ </div>
2039
+ </div>
2040
+ </td>
2041
+ <td class='client-readme-param-content'>
2042
+ <p>Specify the list of query parameters. You can force the query parameters for a query using the url string format (param1=X&amp;param2=Y...).</p>
2043
+
2044
+ </td>
2045
+ </tr>
2046
+
2047
+
2048
+ <tr>
2049
+ <td valign='top'>
2050
+ <div class='client-readme-param-container'>
2051
+ <div class='client-readme-param-container-inner'>
2052
+ <div class='client-readme-param-name'><code>description</code></div>
2053
+
2054
+ </div>
2055
+ </div>
2056
+ </td>
2057
+ <td class='client-readme-param-content'>
2058
+ <p>Specify a description to describe where the key is used.</p>
2059
+
2060
+ </td>
2061
+ </tr>
2062
+
2063
+
2064
+ </tbody></table>
760
2065
 
761
2066
  ```ruby
762
2067
  # Creates a new global API key that is valid for 300 seconds
@@ -865,7 +2170,7 @@ index.search('another query', function(err, content) {
865
2170
 
866
2171
 
867
2172
  Copy or rename an index
868
- -------------
2173
+ ==================
869
2174
 
870
2175
  You can easily copy or rename an existing index using the `copy` and `move` commands.
871
2176
  **Note**: Move and copy commands overwrite the destination index.
@@ -888,13 +2193,19 @@ puts Algolia.move_index("MyNewIndex", "MyIndex")
888
2193
 
889
2194
 
890
2195
  Backup / Retrieve of all index content
891
- -------------
2196
+ ==================
892
2197
 
893
- You can retrieve all index content for backup purposes or for SEO using the browse method.
894
- This method can retrieve up to 1,000 objects per call and supports full text search and filters but the distinct feature is not available
895
- Unlike the search method, the sort by typo, proximity, geo distance and matched words is not applied, the hits are only sorted by numeric attributes specified in the ranking and the custom ranking.
2198
+ The `search` method cannot return more than 1,000 results. If you need to
2199
+ retrieve all the content of your index (for backup, SEO purposes or for running
2200
+ a script on it), you should use the `browse` method instead. This method lets
2201
+ you retrieve objects beyond the 1,000 limit.
896
2202
 
897
- You can browse the index:
2203
+ This method is optimized for speed. To make it fast, distinct, typo-tolerance,
2204
+ word proximity, geo distance and number of matched words are disabled. Results
2205
+ are still returned ranked by attributes and custom ranking.
2206
+
2207
+
2208
+ Example:
898
2209
 
899
2210
  ```ruby
900
2211
  # Iterate with a filter over the index
@@ -905,8 +2216,9 @@ end
905
2216
 
906
2217
 
907
2218
 
2219
+
908
2220
  Logs
909
- -------------
2221
+ ==================
910
2222
 
911
2223
  You can retrieve the latest logs via this API. Each log entry contains:
912
2224
  * Timestamp in ISO-8601 format
@@ -920,13 +2232,79 @@ You can retrieve the latest logs via this API. Each log entry contains:
920
2232
  * SHA1 ID of entry
921
2233
 
922
2234
  You can retrieve the logs of your last 1,000 API calls and browse them using the offset/length parameters:
923
- * ***offset***: Specify the first entry to retrieve (0-based, 0 is the most recent log entry). Defaults to 0.
924
- * ***length***: Specify the maximum number of entries to retrieve starting at the offset. Defaults to 10. Maximum allowed value: 1,000.
925
- * ***onlyErrors***: Retrieve only logs with an HTTP code different than 200 or 201. (deprecated)
926
- * ***type***: Specify the type of logs to retrieve:
927
- * ***query***: Retrieve only the queries.
928
- * ***build***: Retrieve only the build operations.
929
- * ***error***: Retrieve only the errors (same as ***onlyErrors*** parameters).
2235
+
2236
+ <table><tbody>
2237
+
2238
+ <tr>
2239
+ <td valign='top'>
2240
+ <div class='client-readme-param-container'>
2241
+ <div class='client-readme-param-container-inner'>
2242
+ <div class='client-readme-param-name'><code>offset</code></div>
2243
+
2244
+ </div>
2245
+ </div>
2246
+ </td>
2247
+ <td class='client-readme-param-content'>
2248
+ <p>Specify the first entry to retrieve (0-based, 0 is the most recent log entry). Defaults to 0.</p>
2249
+
2250
+ </td>
2251
+ </tr>
2252
+
2253
+
2254
+ <tr>
2255
+ <td valign='top'>
2256
+ <div class='client-readme-param-container'>
2257
+ <div class='client-readme-param-container-inner'>
2258
+ <div class='client-readme-param-name'><code>length</code></div>
2259
+
2260
+ </div>
2261
+ </div>
2262
+ </td>
2263
+ <td class='client-readme-param-content'>
2264
+ <p>Specify the maximum number of entries to retrieve starting at the offset. Defaults to 10. Maximum allowed value: 1,000.</p>
2265
+
2266
+ </td>
2267
+ </tr>
2268
+
2269
+
2270
+ <tr>
2271
+ <td valign='top'>
2272
+ <div class='client-readme-param-container'>
2273
+ <div class='client-readme-param-container-inner'>
2274
+ <div class='client-readme-param-name'><code>onlyErrors</code></div>
2275
+
2276
+ </div>
2277
+ </div>
2278
+ </td>
2279
+ <td class='client-readme-param-content'>
2280
+ <p>Retrieve only logs with an HTTP code different than 200 or 201. (deprecated)</p>
2281
+
2282
+ </td>
2283
+ </tr>
2284
+
2285
+
2286
+ <tr>
2287
+ <td valign='top'>
2288
+ <div class='client-readme-param-container'>
2289
+ <div class='client-readme-param-container-inner'>
2290
+ <div class='client-readme-param-name'><code>type</code></div>
2291
+
2292
+ </div>
2293
+ </div>
2294
+ </td>
2295
+ <td class='client-readme-param-content'>
2296
+ <p>Specify the type of logs to retrieve:</p>
2297
+
2298
+ <ul>
2299
+ <li><code>query</code>: Retrieve only the queries.</li>
2300
+ <li><code>build</code>: Retrieve only the build operations.</li>
2301
+ <li><code>error</code>: Retrieve only the errors (same as <code>onlyErrors</code> parameters).</li>
2302
+ </ul>
2303
+
2304
+ </td>
2305
+ </tr>
2306
+
2307
+ </tbody></table>
930
2308
 
931
2309
  ```ruby
932
2310
  # Get last 10 log entries
@@ -938,7 +2316,7 @@ puts Algolia.get_logs(0, 100, true).to_json
938
2316
  ```
939
2317
 
940
2318
  Mock
941
- -------------
2319
+ ==================
942
2320
 
943
2321
  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`:
944
2322
 
@@ -967,3 +2345,5 @@ end
967
2345
  ```
968
2346
 
969
2347
 
2348
+
2349
+