algoliasearch 1.12.5 → 1.12.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -2
- data/README.md +729 -516
- data/algoliasearch.gemspec +3 -3
- data/lib/algolia/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee4e08848e1a0b3f4469563e6cba2f4f568d6b58
|
4
|
+
data.tar.gz: db1a5a733ecaab566798530819e6375dce7437d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7a3c6d0a7edb20799e6e9629913d3bc9153a56b8ebc4fa9373d44c30d64b30b254fe5be6ba37e6efdb3500ad3dbe0ff5f69a7ec4628ea07793814af1fd5db5
|
7
|
+
data.tar.gz: ab6d24dc66f42a09f96745bf76fcb9e7683d8b15058b2b81f93421fccb8c1bc025ae7680e575735dc34f4ab99fbf7ee258900c1f96893ccc1f7ddb60de324072
|
data/ChangeLog
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
net-http-persistent (>= 2.7)
|
32
32
|
net-http-pipeline
|
33
33
|
highline (1.6.21)
|
34
|
-
httpclient (2.8.
|
34
|
+
httpclient (2.8.3)
|
35
35
|
json (1.8.3)
|
36
36
|
json (1.8.3-java)
|
37
37
|
launchy (2.4.3)
|
@@ -311,7 +311,7 @@ PLATFORMS
|
|
311
311
|
DEPENDENCIES
|
312
312
|
coveralls
|
313
313
|
highline (< 1.7.0)
|
314
|
-
httpclient (~> 2.8.
|
314
|
+
httpclient (~> 2.8.3)
|
315
315
|
json (>= 1.5.1)
|
316
316
|
mime-types (< 2.0)
|
317
317
|
rake
|
@@ -323,3 +323,6 @@ DEPENDENCIES
|
|
323
323
|
simplecov
|
324
324
|
travis
|
325
325
|
webmock
|
326
|
+
|
327
|
+
BUNDLED WITH
|
328
|
+
1.13.6
|
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# Algolia Search API Client for Ruby
|
2
2
|
|
3
3
|
[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.
|
4
|
+
The **Algolia Search API Client for Ruby** lets you easily use the [Algolia Search REST API](https://www.algolia.com/doc/rest-api/search) from your Ruby code.
|
4
5
|
|
5
|
-
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).
|
6
6
|
[![Build Status](https://travis-ci.org/algolia/algoliasearch-client-ruby.svg?branch=master)](https://travis-ci.org/algolia/algoliasearch-client-ruby) [![Gem Version](https://badge.fury.io/rb/algoliasearch.svg)](http://badge.fury.io/rb/algoliasearch) [![Code Climate](https://codeclimate.com/github/algolia/algoliasearch-client-ruby.svg)](https://codeclimate.com/github/algolia/algoliasearch-client-ruby) [![Coverage Status](https://coveralls.io/repos/algolia/algoliasearch-client-ruby/badge.svg)](https://coveralls.io/r/algolia/algoliasearch-client-ruby)
|
7
7
|
|
8
8
|
|
9
|
+
**Note:** An easier-to-read version of this documentation is available on
|
10
|
+
[Algolia's website](https://www.algolia.com/doc/api-client/ruby/).
|
11
|
+
|
9
12
|
# Table of Contents
|
10
13
|
|
11
14
|
|
@@ -17,10 +20,10 @@ Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia
|
|
17
20
|
|
18
21
|
**Search**
|
19
22
|
|
20
|
-
1. [Search
|
23
|
+
1. [Search an index - `search`](#search-an-index---search)
|
21
24
|
1. [Search Response Format](#search-response-format)
|
22
25
|
1. [Search Parameters](#search-parameters)
|
23
|
-
1. [Search
|
26
|
+
1. [Search multiple indices - `multiple_queries`](#search-multiple-indices---multiplequeries)
|
24
27
|
1. [Get Objects - `get_objects`](#get-objects---getobjects)
|
25
28
|
1. [Search for facet values - `search_for_facet_values`](#search-for-facet-values---searchforfacetvalues)
|
26
29
|
|
@@ -51,15 +54,15 @@ Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia
|
|
51
54
|
1. [Typos](#typos)
|
52
55
|
1. [Geo-Search](#geo-search)
|
53
56
|
1. [Query Strategy](#query-strategy)
|
54
|
-
1. [
|
57
|
+
1. [Performance](#performance)
|
55
58
|
1. [Advanced](#advanced)
|
56
59
|
|
57
60
|
**Manage Indices**
|
58
61
|
|
59
62
|
1. [Create an index](#create-an-index)
|
60
63
|
1. [List indices - `list_indexes`](#list-indices---listindexes)
|
61
|
-
1. [Delete index - `delete_index`](#delete-index---deleteindex)
|
62
|
-
1. [Clear index - `clear_index`](#clear-index---clearindex)
|
64
|
+
1. [Delete an index - `delete_index`](#delete-an-index---deleteindex)
|
65
|
+
1. [Clear an index - `clear_index`](#clear-an-index---clearindex)
|
63
66
|
1. [Copy index - `copy_index`](#copy-index---copyindex)
|
64
67
|
1. [Move index - `move_index`](#move-index---moveindex)
|
65
68
|
|
@@ -87,7 +90,7 @@ Our Ruby client lets you easily use the [Algolia Search API](https://www.algolia
|
|
87
90
|
1. [Update user key - `update_user_key`](#update-user-key---updateuserkey)
|
88
91
|
1. [Delete user key - `delete_user_key`](#delete-user-key---deleteuserkey)
|
89
92
|
1. [Get key permissions - `get_user_key_acl`](#get-key-permissions---getuserkeyacl)
|
90
|
-
1. [Get
|
93
|
+
1. [Get latest logs - `get_logs`](#get-latest-logs---getlogs)
|
91
94
|
1. [REST API](#rest-api)
|
92
95
|
|
93
96
|
**Mocking**
|
@@ -185,7 +188,7 @@ puts index.search('or').to_json
|
|
185
188
|
puts index.search('jim').to_json
|
186
189
|
```
|
187
190
|
|
188
|
-
**Note:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-javascript) to perform queries.
|
191
|
+
**Note:** **Note:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-javascript) to perform queries.
|
189
192
|
|
190
193
|
It brings two benefits:
|
191
194
|
* Your users get a better response time by not going through your servers
|
@@ -226,7 +229,7 @@ function searchCallback(err, content) {
|
|
226
229
|
|
227
230
|
|
228
231
|
|
229
|
-
## Search
|
232
|
+
## Search an index - `search`
|
230
233
|
|
231
234
|
**Notes:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-javascript) to perform queries. It brings two benefits:
|
232
235
|
* Your users get a better response time by not going through your servers
|
@@ -293,7 +296,7 @@ The server response will look like:
|
|
293
296
|
|
294
297
|
- `value` (string): Markup text with occurrences highlighted. The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag).
|
295
298
|
|
296
|
-
- `matchLevel` (string, enum) = {`none`
|
299
|
+
- `matchLevel` (string, enum) = {`none` \| `partial` \| `full`}: Indicates how well the attribute matched the search query.
|
297
300
|
|
298
301
|
- `matchedWords` (array): List of words *from the query* that matched the object.
|
299
302
|
|
@@ -305,7 +308,7 @@ The server response will look like:
|
|
305
308
|
|
306
309
|
- `value` (string): Markup text with occurrences highlighted and optional ellipsis indicators. The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag). The text used to indicate ellipsis is specified via [snippetEllipsisText](#snippetellipsistext).
|
307
310
|
|
308
|
-
- `matchLevel` (string, enum) = {`none`
|
311
|
+
- `matchLevel` (string, enum) = {`none` \| `partial` \| `full`}: Indicates how well the attribute matched the search query.
|
309
312
|
|
310
313
|
- `_rankingInfo` (object, optional): Ranking information. *Note: Only returned when [getRankingInfo](#getrankinginfo) is `true`.*
|
311
314
|
|
@@ -327,6 +330,14 @@ The server response will look like:
|
|
327
330
|
|
328
331
|
- `filters` (integer): *This field is reserved for advanced usage.* It will be zero in most cases.
|
329
332
|
|
333
|
+
- `matchedGeoLocation` (object): Geo location that matched the query. *Note: Only returned for a geo search.*
|
334
|
+
|
335
|
+
- `lat` (float): Latitude of the matched location.
|
336
|
+
|
337
|
+
- `lng` (float): Longitude of the matched location.
|
338
|
+
|
339
|
+
- `distance` (integer): Distance between the matched location and the search location (in meters). **Caution:** Contrary to `geoDistance`, this value is *not* divided by the geo precision.
|
340
|
+
|
330
341
|
- `_distinctSeqID` (integer): *Note: Only returned when [distinct](#distinct) is non-zero.* When two consecutive results have the same value for the attribute used for "distinct", this field is used to distinguish between them.
|
331
342
|
|
332
343
|
- `nbHits` (integer): Number of hits that the search query matched.
|
@@ -357,9 +368,9 @@ When [getRankingInfo](#getrankinginfo) is set to `true`, the following additiona
|
|
357
368
|
|
358
369
|
- `parsedQuery` (string): The query string that will be searched, after normalization. Normalization includes removing stop words (if [removeStopWords](#removestopwords) is enabled), and transforming portions of the query string into phrase queries (see [advancedSyntax](#advancedsyntax)).
|
359
370
|
|
360
|
-
- `timeoutCounts` (boolean)
|
371
|
+
- `timeoutCounts` (boolean) - DEPRECATED: Please use `exhaustiveFacetsCount` in remplacement.
|
361
372
|
|
362
|
-
- `timeoutHits` (boolean)
|
373
|
+
- `timeoutHits` (boolean) - DEPRECATED: Please use `exhaustiveFacetsCount` in remplacement.
|
363
374
|
|
364
375
|
... and ranking information is also added to each of the hits (see above).
|
365
376
|
|
@@ -383,7 +394,7 @@ When [facets](#facets) is non-empty, the following additional fields are returne
|
|
383
394
|
|
384
395
|
- `sum` (integer | float): The sum of all values in the result set.
|
385
396
|
|
386
|
-
- `exhaustiveFacetsCount` (boolean): Whether the counts are exhaustive (`true`) or approximate (`false`). *Note:
|
397
|
+
- `exhaustiveFacetsCount` (boolean): Whether the counts are exhaustive (`true`) or approximate (`false`). *Note: In some conditions when [distinct](#distinct) is greater than 1 and an empty query without refinement is sent, the facet counts may not always be exhaustive.*
|
387
398
|
|
388
399
|
## Search Parameters
|
389
400
|
|
@@ -443,6 +454,7 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
|
|
443
454
|
|
444
455
|
**Query Strategy**
|
445
456
|
|
457
|
+
- [queryType](#querytype) `search`, `settings`
|
446
458
|
- [removeWordsIfNoResults](#removewordsifnoresults) `settings`, `search`
|
447
459
|
- [advancedSyntax](#advancedsyntax) `settings`, `search`
|
448
460
|
- [optionalWords](#optionalwords) `settings`, `search`
|
@@ -452,18 +464,18 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
|
|
452
464
|
|
453
465
|
**Advanced**
|
454
466
|
|
455
|
-
- [minProximity](#minproximity) `settings`, `search`
|
456
|
-
- [responseFields](#responsefields) `settings`, `search`
|
457
467
|
- [distinct](#distinct) `settings`, `search`
|
458
468
|
- [getRankingInfo](#getrankinginfo) `search`
|
459
469
|
- [numericFilters](#numericfilters) `search`
|
460
|
-
- [tagFilters
|
470
|
+
- [tagFilters](#tagfilters) `search`
|
461
471
|
- [analytics](#analytics) `search`
|
462
472
|
- [analyticsTags](#analyticstags) `search`
|
463
473
|
- [synonyms](#synonyms) `search`
|
464
474
|
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `settings`, `search`
|
475
|
+
- [minProximity](#minproximity) `settings`, `search`
|
476
|
+
- [responseFields](#responsefields) `settings`, `search`
|
465
477
|
|
466
|
-
## Search
|
478
|
+
## Search multiple indices - `multiple_queries`
|
467
479
|
|
468
480
|
You can send multiple queries with a single API call using a batch of queries:
|
469
481
|
|
@@ -487,7 +499,7 @@ You can specify a `strategy` parameter to optimize your multiple queries:
|
|
487
499
|
|
488
500
|
The resulting JSON contains the following fields:
|
489
501
|
|
490
|
-
- `results` (array): The results for each request, in the order they were submitted. The contents are the same as in [Search
|
502
|
+
- `results` (array): The results for each request, in the order they were submitted. The contents are the same as in [Search an index](#search-an-index).
|
491
503
|
Each result also includes the following additional fields:
|
492
504
|
|
493
505
|
- `index` (string): The name of the targeted index.
|
@@ -529,7 +541,7 @@ that both:
|
|
529
541
|
1. match the facet query; and
|
530
542
|
2. are contained in objects matching the regular search query.
|
531
543
|
|
532
|
-
**Warning:**
|
544
|
+
**Warning:** For a facet to be searchable, it must have been declared with the `searchable()` modifier in the [attributesForFaceting](#attributesforfaceting) index setting.
|
533
545
|
|
534
546
|
#### Example
|
535
547
|
|
@@ -728,7 +740,7 @@ index.partial_update_object({"price" => {"value" => 42, "_operation" => "Decreme
|
|
728
740
|
Note: Here we are decrementing the value by `42`. To decrement just by one, put
|
729
741
|
`value:1`.
|
730
742
|
|
731
|
-
To partial update multiple objects using one API call, you can use the
|
743
|
+
To partial update multiple objects using one API call, you can use the following method:
|
732
744
|
|
733
745
|
```ruby
|
734
746
|
res = index.partial_update_objects([{"firstname" => "Jimmie",
|
@@ -745,7 +757,7 @@ You can delete objects using their `objectID`:
|
|
745
757
|
res = index.delete_objects(["myID1", "myID2"])
|
746
758
|
```
|
747
759
|
|
748
|
-
To delete a single object, you can use the
|
760
|
+
To delete a single object, you can use the following method:
|
749
761
|
|
750
762
|
```ruby
|
751
763
|
index.delete_object("myID")
|
@@ -868,15 +880,16 @@ Parameters that can be overridden at search time also have the `search` [scope](
|
|
868
880
|
|
869
881
|
**Query Strategy**
|
870
882
|
|
871
|
-
- [queryType](#querytype) `settings`
|
883
|
+
- [queryType](#querytype) `search`, `settings`
|
872
884
|
- [removeWordsIfNoResults](#removewordsifnoresults) `settings`, `search`
|
873
885
|
- [advancedSyntax](#advancedsyntax) `settings`, `search`
|
874
886
|
- [optionalWords](#optionalwords) `settings`, `search`
|
875
887
|
- [removeStopWords](#removestopwords) `settings`, `search`
|
888
|
+
- [disablePrefixOnAttributes](#disableprefixonattributes) `settings`
|
876
889
|
- [disableExactOnAttributes](#disableexactonattributes) `settings`
|
877
890
|
- [exactOnSingleWordQuery](#exactonsinglewordquery) `settings`, `search`
|
878
891
|
|
879
|
-
**
|
892
|
+
**Performance**
|
880
893
|
|
881
894
|
- [numericAttributesForFiltering](#numericattributesforfiltering) `settings`
|
882
895
|
- [allowCompressionOfIntegerArray](#allowcompressionofintegerarray) `settings`
|
@@ -884,12 +897,12 @@ Parameters that can be overridden at search time also have the `search` [scope](
|
|
884
897
|
**Advanced**
|
885
898
|
|
886
899
|
- [attributeForDistinct](#attributefordistinct) `settings`
|
900
|
+
- [distinct](#distinct) `settings`, `search`
|
901
|
+
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `settings`, `search`
|
887
902
|
- [placeholders](#placeholders) `settings`
|
888
903
|
- [altCorrections](#altcorrections) `settings`
|
889
904
|
- [minProximity](#minproximity) `settings`, `search`
|
890
905
|
- [responseFields](#responsefields) `settings`, `search`
|
891
|
-
- [distinct](#distinct) `settings`, `search`
|
892
|
-
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `settings`, `search`
|
893
906
|
|
894
907
|
|
895
908
|
# Parameters
|
@@ -901,13 +914,13 @@ Parameters that can be overridden at search time also have the `search` [scope](
|
|
901
914
|
### Scope
|
902
915
|
|
903
916
|
Each parameter in this page has a scope. Depending on the scope, you can use the parameter within the `setSettings`
|
904
|
-
and/or the `search` method
|
917
|
+
and/or the `search` method.
|
905
918
|
|
906
|
-
|
919
|
+
There are three scopes:
|
907
920
|
|
908
|
-
- `settings`: The setting can only be used in the `setSettings` method
|
909
|
-
- `search`: The setting can only be used in the `search` method
|
910
|
-
- `settings` `search`: The setting can be used in the `setSettings` method and be
|
921
|
+
- `settings`: The setting can only be used in the `setSettings` method.
|
922
|
+
- `search`: The setting can only be used in the `search` method.
|
923
|
+
- `settings` `search`: The setting can be used in the `setSettings` method and be overridden in the`search` method.
|
911
924
|
|
912
925
|
### Parameters List
|
913
926
|
|
@@ -976,17 +989,17 @@ They are three scopes:
|
|
976
989
|
|
977
990
|
**Query Strategy**
|
978
991
|
|
979
|
-
- [queryType](#querytype) `settings`
|
992
|
+
- [queryType](#querytype) `search`, `settings`
|
980
993
|
- [removeWordsIfNoResults](#removewordsifnoresults) `settings`, `search`
|
981
994
|
- [advancedSyntax](#advancedsyntax) `settings`, `search`
|
982
995
|
- [optionalWords](#optionalwords) `settings`, `search`
|
983
996
|
- [removeStopWords](#removestopwords) `settings`, `search`
|
984
|
-
- [disablePrefixOnAttributes](#disableprefixonattributes) `
|
997
|
+
- [disablePrefixOnAttributes](#disableprefixonattributes) `settings`
|
985
998
|
- [disableExactOnAttributes](#disableexactonattributes) `settings`
|
986
999
|
- [exactOnSingleWordQuery](#exactonsinglewordquery) `settings`, `search`
|
987
1000
|
- [alternativesAsExact](#alternativesasexact) `setting`, `search`
|
988
1001
|
|
989
|
-
**
|
1002
|
+
**Performance**
|
990
1003
|
|
991
1004
|
- [numericAttributesForFiltering](#numericattributesforfiltering) `settings`
|
992
1005
|
- [allowCompressionOfIntegerArray](#allowcompressionofintegerarray) `settings`
|
@@ -994,453 +1007,552 @@ They are three scopes:
|
|
994
1007
|
**Advanced**
|
995
1008
|
|
996
1009
|
- [attributeForDistinct](#attributefordistinct) `settings`
|
997
|
-
- [placeholders](#placeholders) `settings`
|
998
|
-
- [altCorrections](#altcorrections) `settings`
|
999
|
-
- [minProximity](#minproximity) `settings`, `search`
|
1000
|
-
- [responseFields](#responsefields) `settings`, `search`
|
1001
1010
|
- [distinct](#distinct) `settings`, `search`
|
1002
1011
|
- [getRankingInfo](#getrankinginfo) `search`
|
1003
1012
|
- [numericFilters](#numericfilters) `search`
|
1004
|
-
- [tagFilters
|
1013
|
+
- [tagFilters](#tagfilters) `search`
|
1005
1014
|
- [analytics](#analytics) `search`
|
1006
1015
|
- [analyticsTags](#analyticstags) `search`
|
1007
1016
|
- [synonyms](#synonyms) `search`
|
1008
1017
|
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `settings`, `search`
|
1018
|
+
- [placeholders](#placeholders) `settings`
|
1019
|
+
- [altCorrections](#altcorrections) `settings`
|
1020
|
+
- [minProximity](#minproximity) `settings`, `search`
|
1021
|
+
- [responseFields](#responsefields) `settings`, `search`
|
1009
1022
|
|
1010
1023
|
## Search
|
1011
1024
|
|
1012
1025
|
#### query
|
1013
1026
|
|
1014
1027
|
- scope: `search`
|
1015
|
-
- type:
|
1016
|
-
- default: ""
|
1028
|
+
- type: string
|
1029
|
+
- default: `""`
|
1017
1030
|
|
1018
|
-
The search
|
1019
|
-
If no query parameter is set, the textual search will match with all the objects.
|
1031
|
+
The text to search for in the index. If empty or absent, the textual search will match any object.
|
1020
1032
|
|
1021
1033
|
## Attributes
|
1022
1034
|
|
1023
1035
|
#### searchableAttributes
|
1024
1036
|
|
1025
1037
|
- scope: `settings`
|
1026
|
-
- type:
|
1027
|
-
- default:
|
1038
|
+
- type: array of strings
|
1039
|
+
- default: `[]` (all string attributes)
|
1028
1040
|
- formerly known as: `attributesToIndex`
|
1029
1041
|
|
1030
|
-
|
1042
|
+
List of attributes eligible for textual search.
|
1043
|
+
In search engine parlance, those attributes will be "indexed", i.e. their content will be made searchable.
|
1031
1044
|
|
1032
|
-
If
|
1033
|
-
|
1045
|
+
If not specified or empty, all string values of all attributes are indexed.
|
1046
|
+
If specified, only the specified attributes are indexed; any numerical values within those attributes are converted to strings and indexed.
|
1047
|
+
|
1048
|
+
When an attribute is listed, it is *recursively* processed, i.e. all of its nested attributes, at any depth, are indexed
|
1049
|
+
according to the same policy.
|
1050
|
+
|
1051
|
+
**Note:** Make sure you adjust this setting to get optimal results.
|
1034
1052
|
|
1035
1053
|
This parameter has two important uses:
|
1036
1054
|
|
1037
|
-
1. **Limit the
|
1038
|
-
|
1055
|
+
1. **Limit the scope of the search.**
|
1056
|
+
Restricting the searchable attributes to those containing meaningful text guarantees a better relevance.
|
1057
|
+
For example, if your objects have associated pictures, you need to store the picture URLs in the records
|
1058
|
+
in order to retrieve them for display at query time, but you probably don't want to *search* inside the URLs.
|
1059
|
+
|
1060
|
+
A side effect of limiting the attributes is **increased performance**: it keeps the index size at a minimum, which
|
1061
|
+
has a direct and positive impact on both build time and search speed.
|
1039
1062
|
|
1040
1063
|
2. **Control part of the ranking.** The contents of the `searchableAttributes` parameter impacts ranking in two complementary ways:
|
1041
|
-
First, the order in which attributes are listed defines their ranking priority: matches in attributes at the beginning of the
|
1042
|
-
list will be considered more important than matches in attributes further down the list. To assign the same priority to several attributes,
|
1043
|
-
pass them within the same string, separated by commas. For example, by specifying `["title,"alternative_title", "text"]`,
|
1044
|
-
`title` and `alternative_title` will have the same priority, but a higher priority than `text`.
|
1045
1064
|
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1065
|
+
- **Attribute priority**: The order in which attributes are listed defines their ranking priority:
|
1066
|
+
matches in attributes at the beginning of the list will be considered more important than matches in
|
1067
|
+
attributes further down the list.
|
1068
|
+
|
1069
|
+
To assign the same priority to several attributes, pass them within the same string, separated by commas.
|
1070
|
+
For example, by specifying `["title,alternative_title", "text"]`, `title` and `alternative_title` will have
|
1071
|
+
the same priority, but a higher priority than `text`.
|
1049
1072
|
|
1050
|
-
|
1051
|
-
|
1073
|
+
- **Importance of word positions**: Within a given attribute, matches near the beginning of the text are considered more
|
1074
|
+
important than matches near the end.
|
1075
|
+
You can disable this behavior by wrapping your attribute name inside an `unordered()` modifier.
|
1076
|
+
For example, `["title", "unordered(text)"]` will consider all positions inside the `text` attribute as equal,
|
1077
|
+
but positions inside the `title` attribute will still matter.
|
1052
1078
|
|
1053
|
-
To get a full description of how the ranking works, you can have a look at our [Ranking guide](https://www.algolia.com/doc/guides/relevance/ranking).
|
1079
|
+
**Note:** To get a full description of how the ranking works, you can have a look at our [Ranking guide](https://www.algolia.com/doc/guides/relevance/ranking).
|
1054
1080
|
|
1055
1081
|
#### attributesForFaceting
|
1056
1082
|
|
1057
1083
|
- scope: `settings`
|
1058
|
-
- type:
|
1084
|
+
- type: array of strings
|
1085
|
+
- default: `[]`
|
1086
|
+
|
1087
|
+
List of attributes you want to use for faceting.
|
1059
1088
|
|
1060
|
-
The list of attributes you want to use for faceting.
|
1061
1089
|
All strings within these attributes will be extracted and added as facets.
|
1062
|
-
If
|
1090
|
+
If not specified or empty, no attribute will be faceted.
|
1091
|
+
|
1092
|
+
If you only need to filter on a given facet, but are not interested in value counts for this facet,
|
1093
|
+
you can improve performances by specifying `filterOnly(${attributeName})`. This decreases the size of the index
|
1094
|
+
and the time required to build it.
|
1063
1095
|
|
1064
|
-
If you
|
1096
|
+
If you want to search inside values of a given facet (using the [Search for facet values](#search-for-facet-values) method)
|
1097
|
+
you need to specify `searchable(${attributeName})`.
|
1065
1098
|
|
1066
|
-
|
1099
|
+
**Note:** The `filterOnly()` and `searchable()` modifiers are mutually exclusive.
|
1067
1100
|
|
1068
1101
|
#### unretrievableAttributes
|
1069
1102
|
|
1070
1103
|
- scope: `settings`
|
1071
|
-
- type:
|
1104
|
+
- type: array of strings
|
1105
|
+
- default: `[]`
|
1106
|
+
|
1107
|
+
List of attributes that cannot be retrieved at query time.
|
1072
1108
|
|
1073
|
-
|
1074
|
-
This feature allows you to have attributes that are used for indexing
|
1075
|
-
and/or ranking but cannot be retrieved.
|
1109
|
+
These attributes can still be used for indexing and/or ranking.
|
1076
1110
|
|
1077
|
-
This setting
|
1078
|
-
{.alert .alert-info}
|
1111
|
+
**Note:** This setting is bypassed when the query is authenticated with the **admin API key**.
|
1079
1112
|
|
1080
1113
|
#### attributesToRetrieve
|
1081
1114
|
|
1082
1115
|
- scope: `settings` `search`
|
1083
|
-
- type:
|
1084
|
-
- default:
|
1116
|
+
- type: array of strings
|
1117
|
+
- default: `*` (all attributes)
|
1118
|
+
- formerly known as: `attributes`
|
1085
1119
|
|
1086
|
-
List of attributes you want to retrieve
|
1087
|
-
This can be
|
1120
|
+
List of object attributes you want to retrieve.
|
1121
|
+
This can be used to minimize the size of the response.
|
1088
1122
|
|
1089
1123
|
You can use `*` to retrieve all values.
|
1090
1124
|
|
1091
1125
|
**Note:** `objectID` is always retrieved, even when not specified.
|
1092
1126
|
|
1127
|
+
**Note:** Attributes listed in [unretrievableAttributes](#unretrievableattributes) will not be retrieved even if requested,
|
1128
|
+
unless the request is authenticated with the admin API key.
|
1129
|
+
|
1093
1130
|
#### restrictSearchableAttributes
|
1094
1131
|
|
1095
1132
|
- scope: `search`
|
1096
|
-
- type:
|
1097
|
-
- default: all attributes in searchableAttributes
|
1098
|
-
|
1099
|
-
List of attributes you want to use for textual search.
|
1133
|
+
- type: array of strings
|
1134
|
+
- default: all attributes in `searchableAttributes`
|
1100
1135
|
|
1101
|
-
|
1136
|
+
List of attributes to be considered for textual search.
|
1102
1137
|
|
1103
|
-
|
1138
|
+
**Note:** It must be a subset of the [searchableAttributes](#searchableattributes) index setting.
|
1139
|
+
Consequently, `searchableAttributes` must not be empty nor null for `restrictSearchableAttributes` to be allowed.
|
1104
1140
|
|
1105
1141
|
## Ranking
|
1106
1142
|
|
1107
1143
|
#### ranking
|
1108
1144
|
|
1109
1145
|
- scope: `settings`
|
1110
|
-
- type:
|
1111
|
-
- default: [
|
1146
|
+
- type: array of strings
|
1147
|
+
- default: `["typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"]`
|
1112
1148
|
|
1113
1149
|
Controls the way results are sorted.
|
1114
1150
|
|
1115
|
-
|
1151
|
+
You must specify a list of ranking criteria. They will be applied in sequence by the tie-breaking algorithm
|
1152
|
+
in the order they are specified.
|
1116
1153
|
|
1117
|
-
|
1118
|
-
|
1119
|
-
* `
|
1120
|
-
* `
|
1121
|
-
|
1154
|
+
The following ranking criteria are available:
|
1155
|
+
|
1156
|
+
* `typo`: Sort by increasing number of typos.
|
1157
|
+
* `geo`: Sort by decreasing geo distance when performing a geo search.
|
1158
|
+
This criterion is ignored when not performing a geo search.
|
1159
|
+
* `words`: Sort by decreasing number of matched query words.
|
1160
|
+
This parameter is useful when you use the [optionalWords](#optionalwords) query parameter to rank hits with the most matched words first.
|
1161
|
+
* `proximity`: Sort by increasing proximity of query words in hits.
|
1162
|
+
* `attribute`: Sort according to the order of attributes defined by [searchableAttributes](#searchableattributes).
|
1122
1163
|
* `exact`:
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
* `
|
1127
|
-
*
|
1164
|
+
- **If the query contains only one word:** The behavior depends on the value of [exactOnSingleWordQuery](#exactonsinglewordquery).
|
1165
|
+
- **If the query contains multiple words:** Sort by decreasing number of words that matched exactly.
|
1166
|
+
What is considered to be an exact match depends on the value of [alternativesAsExact](#alternativesasexact).
|
1167
|
+
* `custom`: Sort according to a user-defined formula specified via the [customRanking](#customranking) setting.
|
1168
|
+
* Sort by value of a numeric attribute. Here, `${attributeName}` can be the name of any numeric attribute in your objects (integer, floating-point or boolean).
|
1169
|
+
* `asc(${attributeName})`: sort by increasing value of the attribute
|
1170
|
+
* `desc(${attributeName})`: sort by decreasing value of the attribute
|
1128
1171
|
|
1129
|
-
To get a full description of how the
|
1172
|
+
**Note:** To get a full description of how the ranking works, you can have a look at our [Ranking guide](https://www.algolia.com/doc/guides/relevance/ranking).
|
1130
1173
|
|
1131
1174
|
#### customRanking
|
1132
1175
|
|
1133
1176
|
- scope: `settings`
|
1134
|
-
- type:
|
1135
|
-
- default: []
|
1177
|
+
- type: array of strings
|
1178
|
+
- default: `[]`
|
1136
1179
|
|
1137
|
-
|
1180
|
+
Specifies the `custom` ranking criterion.
|
1138
1181
|
|
1139
|
-
|
1140
|
-
|
1182
|
+
Each string must conform to the syntax `asc(${attributeName})` or `desc(${attributeName})` and specifies a
|
1183
|
+
(respectively) increasing or decreasing sort on an attribute. All sorts are applied in sequence by the tie-breaking
|
1184
|
+
algorithm in the order they are specified.
|
1141
1185
|
|
1142
|
-
|
1186
|
+
**Example:** `["desc(population)", "asc(name)"]` will sort by decreasing value of the `population` attribute,
|
1187
|
+
then *in case of equality* by increasing value of the `name` attribute.
|
1143
1188
|
|
1144
|
-
To get a full description of how
|
1189
|
+
**Note:** To get a full description of how custom ranking works,
|
1145
1190
|
you can have a look at our [Ranking guide](https://www.algolia.com/doc/guides/relevance/ranking).
|
1146
1191
|
|
1147
1192
|
#### replicas
|
1148
1193
|
|
1149
1194
|
- scope: `settings`
|
1150
|
-
- type:
|
1151
|
-
- default: []
|
1195
|
+
- type: array of strings
|
1196
|
+
- default: `[]`
|
1152
1197
|
- formerly known as: `slaves`
|
1153
1198
|
|
1154
|
-
|
1199
|
+
List of indices to which you want to replicate all write operations.
|
1155
1200
|
|
1156
|
-
In order to get
|
1201
|
+
In order to get relevant results in milliseconds, we pre-compute part of the ranking during indexing.
|
1202
|
+
Consequently, if you want to use different ranking formulas depending on the use case,
|
1203
|
+
you need to create one index per ranking formula.
|
1157
1204
|
|
1158
|
-
|
1159
|
-
|
1205
|
+
This option allows you to perform write operations on a single, master index and automatically
|
1206
|
+
perform the same operations on all of its replicas.
|
1160
1207
|
|
1161
|
-
|
1162
|
-
|
1208
|
+
**Note:** A master index can have as many replicas as needed. However, a replica can only have one master; in other words,
|
1209
|
+
two master indices cannot have the same replica. Furthermore, a replica cannot have its own replicas
|
1210
|
+
(i.e. you cannot "chain" replicas).
|
1163
1211
|
|
1164
1212
|
## Filtering / Faceting
|
1165
1213
|
|
1166
1214
|
#### filters
|
1167
1215
|
|
1168
1216
|
- scope: `search`
|
1169
|
-
- type:
|
1170
|
-
- default: ""
|
1217
|
+
- type: string
|
1218
|
+
- default: `""`
|
1219
|
+
|
1220
|
+
Filter the query with numeric, facet and/or tag filters.
|
1221
|
+
|
1222
|
+
This parameter uses a SQL-like expression syntax, where you can use boolean operators and parentheses to combine individual filters.
|
1223
|
+
|
1224
|
+
The following **individual filters** are supported:
|
1225
|
+
|
1226
|
+
- **Numeric filter**:
|
1227
|
+
|
1228
|
+
- **Comparison**: `${attributeName} ${operator} ${operand}` matches all objects where the specified numeric attribute satisfies the numeric condition expressed by the operator and the operand. The operand must be a numeric value. Supported operators are `<`, `<=`, `=`, `!=`, `>=` and `>`, with the same semantics as in virtually all programming languages.
|
1229
|
+
Example: `inStock > 0`.
|
1171
1230
|
|
1172
|
-
|
1231
|
+
- **Range**: `${attributeName}:${lowerBound} TO ${upperBound}` matches all objects where the specified numeric
|
1232
|
+
attribute is within the range [`${lowerBound}`, `${upperBound}`] \(inclusive on both ends).
|
1233
|
+
Example: `publication_date: 1441745506 TO 1441755506`.
|
1173
1234
|
|
1174
|
-
|
1175
|
-
The syntax for the underlying numeric, facet and tag filters is the same than in the other filters:
|
1235
|
+
- **Facet filter**: `${facetName}:${facetValue}` matches all objects containing exactly the specified value in the specified facet attribute. *Facet matching is case sensitive*. Example: `category:Book`.
|
1176
1236
|
|
1177
|
-
`
|
1178
|
-
|
1237
|
+
- **Tag filter**: `_tags:${value}` (or, alternatively, just `${value}`) matches all objects containing exactly the specified value in their `_tags` attribute. *Tag matching is case sensitive*. Example: `_tags:published`.
|
1238
|
+
|
1239
|
+
Individual filters can be combined via **boolean operators**. The following operators are supported:
|
1240
|
+
|
1241
|
+
- `OR`: must match any of the combined conditions (disjunction)
|
1242
|
+
- `AND`: must match all of the combined conditions (conjunction)
|
1243
|
+
- `NOT`: negate a filter
|
1244
|
+
|
1245
|
+
Finally, **parentheses** (`(` and `)`) can be used for grouping.
|
1246
|
+
|
1247
|
+
Putting it all together, an example is:
|
1248
|
+
|
1249
|
+
```
|
1250
|
+
available = 1 AND (category:Book OR NOT category:Ebook) AND _tags:published AND publication_date:1441745506 TO 1441755506 AND inStock > 0 AND author:"John Doe"
|
1251
|
+
```
|
1179
1252
|
|
1180
|
-
|
1253
|
+
**Warning:** Keywords are case-sensitive.
|
1181
1254
|
|
1182
|
-
|
1183
|
-
|
1184
|
-
- **TO**: used to specify a range for a numeric filter.
|
1185
|
-
- **NOT**: used to negate a filter.
|
1255
|
+
**Note:** If no attribute name is specified, the filter applies to `_tags`.
|
1256
|
+
For example: `public OR user_42` will translate into `_tags:public OR _tags:user_42`.
|
1186
1257
|
|
1187
|
-
If
|
1188
|
-
the filter applies to `_tags`.
|
1189
|
-
For example: `public OR user_42` will translate to `_tags:public OR _tags:user_42`.
|
1258
|
+
**Note:** If a value contains spaces, or conflicts with a keyword, you can use double quotes.
|
1190
1259
|
|
1191
|
-
|
1260
|
+
**Note:** If a filtered attribute contains an array of values, any matching value will cause the filter to match.
|
1192
1261
|
|
1193
|
-
|
1262
|
+
**Warning:** For performance reasons, filter expressions are limited to a disjunction of conjunctions.
|
1263
|
+
In other words, you can have ANDs of ORs (e.g. `filter1 AND (filter2 OR filter3)`),
|
1264
|
+
but not ORs of ANDs (e.g. `filter1 OR (filter2 AND filter3)`.
|
1194
1265
|
|
1195
|
-
|
1266
|
+
**Warning:** You cannot mix different filter categories inside a disjunction (OR).
|
1267
|
+
For example, `num=3 OR tag1 OR facet:value` is not allowed.
|
1196
1268
|
|
1197
|
-
|
1269
|
+
**Warning:** You cannot negate a group of filters, only an individual filter.
|
1270
|
+
For example, `NOT(filter1 OR filter2)` is not allowed.
|
1198
1271
|
|
1199
1272
|
#### facets
|
1200
1273
|
|
1201
1274
|
- scope: `search`
|
1202
|
-
- type:
|
1203
|
-
- default: []
|
1275
|
+
- type: array of strings
|
1276
|
+
- default: `[]`
|
1204
1277
|
|
1205
|
-
|
1206
|
-
|
1278
|
+
Facets to retrieve.
|
1279
|
+
If not specified or empty, no facets are retrieved.
|
1280
|
+
The special value `*` may be used to retrieve all facets.
|
1207
1281
|
|
1208
|
-
|
1209
|
-
and their associated count for the current query.
|
1282
|
+
**Warning:** Facets must have been declared beforehand in the [attributesForFaceting](#attributesforfaceting) index setting.
|
1210
1283
|
|
1211
|
-
|
1284
|
+
For each of the retrieved facets, the response will contain a list of the most frequent facet values in objects
|
1285
|
+
matching the current query. Each value will be returned with its associated count (number of matched objects containing that value).
|
1212
1286
|
|
1213
|
-
**
|
1287
|
+
**Warning:** Faceting does **not** filter your results. If you want to filter results, you should use [filters](#filters).
|
1214
1288
|
|
1215
|
-
|
1289
|
+
**Example**:
|
1290
|
+
|
1291
|
+
If your settings contain:
|
1216
1292
|
|
1217
1293
|
```
|
1218
|
-
|
1294
|
+
{
|
1295
|
+
"attributesForFaceting": ["category", "author", "nb_views", "nb_downloads"]
|
1296
|
+
}
|
1219
1297
|
```
|
1220
1298
|
|
1221
1299
|
... but, for the current search, you want to retrieve facet values only for `category` and `author`, then you can specify:
|
1222
1300
|
|
1223
1301
|
```
|
1224
|
-
["category", "author"]
|
1302
|
+
"facets": ["category", "author"]
|
1225
1303
|
```
|
1226
1304
|
|
1227
|
-
|
1228
|
-
|
1229
|
-
You can also use `*` to perform faceting on all attributes specified in `attributesForFaceting`.
|
1230
|
-
|
1231
|
-
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.
|
1305
|
+
**Warning:** If the number of hits is high, facet counts may be approximate.
|
1306
|
+
The response field `exhaustiveFacetsCount` is true when the count is exact.
|
1232
1307
|
|
1233
1308
|
#### maxValuesPerFacet
|
1234
1309
|
|
1235
1310
|
- scope: `settings` `search`
|
1236
|
-
- type:
|
1237
|
-
- default: 100
|
1238
|
-
|
1239
|
-
Limit the number of facet values returned for each facet.
|
1311
|
+
- type: integer
|
1312
|
+
- default: `100`
|
1240
1313
|
|
1241
|
-
|
1314
|
+
Maximum number of facet values returned for each facet.
|
1242
1315
|
|
1243
|
-
**
|
1244
|
-
|
1316
|
+
**Warning:** The API enforces a hard limit of 1000 on `maxValuesPerFacet`.
|
1317
|
+
Any value above that limit will be interpreted as 1000.
|
1245
1318
|
|
1246
1319
|
#### facetFilters
|
1247
1320
|
|
1248
1321
|
- scope: `search`
|
1249
|
-
- type:
|
1250
|
-
- default:
|
1322
|
+
- type: array of strings
|
1323
|
+
- default: `[]`
|
1324
|
+
|
1325
|
+
Filter hits by facet value.
|
1326
|
+
|
1327
|
+
**Note:** The [filters](#filters) parameter provides an easier to use, SQL-like syntax.
|
1328
|
+
We recommend using it instead of `facetFilters`.
|
1251
1329
|
|
1252
|
-
|
1253
|
-
and is easier to use for most usecases
|
1330
|
+
Each string represents a filter on a given facet value. It must follow the syntax `${attributeName}:${value}`.
|
1254
1331
|
|
1255
|
-
|
1332
|
+
If you specify multiple filters, they are interpreted as a conjunction (AND). If you want to use a disjunction (OR),
|
1333
|
+
use a nested array.
|
1256
1334
|
|
1257
|
-
|
1335
|
+
Examples:
|
1258
1336
|
|
1259
|
-
|
1260
|
-
`(category:Book OR category:Movie) AND author:John
|
1337
|
+
- `["category:Book", "author:John Doe"]` translates as `category:Book AND author:"John Doe"`
|
1338
|
+
- `[["category:Book", "category:Movie"], "author:John Doe"]` translates as `(category:Book OR category:Movie) AND author:"John Doe"`
|
1339
|
+
|
1340
|
+
Negation is supported by prefixing the value with a minus sign (`-`, a.k.a. dash).
|
1341
|
+
For example: `["category:Book", "category:-Movie"]` translates as `category:Book AND NOT category:Movie`.
|
1261
1342
|
|
1262
1343
|
## Highlighting / Snippeting
|
1263
1344
|
|
1264
1345
|
#### attributesToHighlight
|
1265
1346
|
|
1266
1347
|
- scope: `settings` `search`
|
1267
|
-
- type:
|
1348
|
+
- type: array of strings
|
1349
|
+
- default: all searchable attributes
|
1268
1350
|
|
1269
1351
|
List of attributes to highlight.
|
1270
|
-
If set to null, all
|
1352
|
+
If set to null, all **searchable** attributes are highlighted (see [searchableAttributes](#searchableattributes)).
|
1353
|
+
The special value `*` may be used to highlight all attributes.
|
1354
|
+
|
1355
|
+
**Note:** Only string values can be highlighted. Numerics will be ignored.
|
1356
|
+
|
1357
|
+
When highlighting is enabled, each hit in the response will contain an additional `_highlightResult` object
|
1358
|
+
(provided that at least one of its attributes is highlighted) with the following fields:
|
1359
|
+
|
1360
|
+
<!-- TODO: Factorize the following with the "Search Response Format" section in the API Client doc. -->
|
1271
1361
|
|
1272
|
-
|
1362
|
+
- `value` (string): Markup text with occurrences highlighted.
|
1363
|
+
The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag).
|
1273
1364
|
|
1274
|
-
|
1275
|
-
You can use `*` if you want to highlight all attributes.
|
1365
|
+
- `matchLevel` (string, enum) = {`none` \| `partial` \| `full`}: Indicates how well the attribute matched the search query.
|
1276
1366
|
|
1277
|
-
|
1367
|
+
- `matchedWords` (array): List of words *from the query* that matched the object.
|
1278
1368
|
|
1279
|
-
|
1280
|
-
* `partial`: If only some of the query terms were found.
|
1281
|
-
* `none`: If none of the query terms were found.
|
1369
|
+
- `fullyHighlighted` (boolean): Whether the entire attribute value is highlighted.
|
1282
1370
|
|
1283
1371
|
#### attributesToSnippet
|
1284
1372
|
|
1285
1373
|
- scope: `settings` `search`
|
1286
|
-
- type:
|
1287
|
-
- default: [] (no attribute is snippeted)
|
1374
|
+
- type: array of strings
|
1375
|
+
- default: `[]` (no attribute is snippeted)
|
1376
|
+
|
1377
|
+
List of attributes to snippet, with an optional maximum number of words to snippet.
|
1378
|
+
If set to null, no attributes are snippeted.
|
1379
|
+
The special value `*` may be used to snippet all attributes.
|
1380
|
+
|
1381
|
+
The syntax for each attribute is `${attributeName}:${nbWords}`.
|
1382
|
+
The number of words can be omitted, and defaults to 10.
|
1383
|
+
|
1384
|
+
**Note:** Only string values can be snippeted. Numerics will be ignored.
|
1288
1385
|
|
1289
|
-
|
1386
|
+
When snippeting is enabled, each hit in the response will contain an additional `_snippetResult` object
|
1387
|
+
(provided that at least one of its attributes is snippeted) with the following fields:
|
1388
|
+
|
1389
|
+
<!-- TODO: Factorize the following with the "Search Response Format" section in the API Client doc. -->
|
1390
|
+
|
1391
|
+
- `value` (string): Markup text with occurrences highlighted and optional ellipsis indicators.
|
1392
|
+
The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag).
|
1393
|
+
The text used to indicate ellipsis is specified via [snippetEllipsisText](#snippetellipsistext).
|
1394
|
+
|
1395
|
+
- `matchLevel` (string, enum) = {`none` \| `partial` \| `full`}: Indicates how well the attribute matched the search query.
|
1290
1396
|
|
1291
1397
|
#### highlightPreTag
|
1292
1398
|
|
1293
1399
|
- scope: `settings` `search`
|
1294
|
-
- type:
|
1295
|
-
- default: <em>
|
1400
|
+
- type: string
|
1401
|
+
- default: `"<em>"`
|
1296
1402
|
|
1297
|
-
|
1403
|
+
String inserted before highlighted parts in highlight and snippet results.
|
1298
1404
|
|
1299
1405
|
#### highlightPostTag
|
1300
1406
|
|
1301
1407
|
- scope: `settings` `search`
|
1302
|
-
- type:
|
1303
|
-
- default: </em>
|
1408
|
+
- type: string
|
1409
|
+
- default: `"</em>"`
|
1304
1410
|
|
1305
|
-
|
1411
|
+
String inserted after highlighted parts in highlight and snippet results.
|
1306
1412
|
|
1307
1413
|
#### snippetEllipsisText
|
1308
1414
|
|
1309
1415
|
- scope: `settings` `search`
|
1310
|
-
- type:
|
1311
|
-
- default:
|
1416
|
+
- type: string
|
1417
|
+
- default: `…` (U+2026)
|
1312
1418
|
|
1313
1419
|
String used as an ellipsis indicator when a snippet is truncated.
|
1314
1420
|
|
1315
|
-
Defaults to an empty string for all accounts created before
|
1421
|
+
**Warning:** Defaults to an empty string for all accounts created before February 10th, 2016.
|
1422
|
+
Defaults to `…` (U+2026, HORIZONTAL ELLIPSIS) for accounts created after that date.
|
1316
1423
|
|
1317
1424
|
#### restrictHighlightAndSnippetArrays
|
1318
1425
|
|
1319
1426
|
- scope: `settings` `search`
|
1320
|
-
- type:
|
1321
|
-
- default: false
|
1427
|
+
- type: boolean
|
1428
|
+
- default: `false`
|
1322
1429
|
|
1323
|
-
|
1430
|
+
When true, restrict arrays in highlight and snippet results to items that matched the query at least partially.
|
1431
|
+
When false, return all array items in highlight and snippet results.
|
1324
1432
|
|
1325
1433
|
## Pagination
|
1326
1434
|
|
1327
1435
|
#### page
|
1328
1436
|
|
1329
1437
|
- scope: `search`
|
1330
|
-
- type:
|
1331
|
-
- default: 0
|
1438
|
+
- type: integer
|
1439
|
+
- default: `0`
|
1332
1440
|
|
1333
|
-
|
1441
|
+
Number of the page to retrieve.
|
1334
1442
|
|
1335
|
-
**Warning:** Page
|
1443
|
+
**Warning:** Page numbers are zero-based. Therefore, in order to retrieve the 10th page, you need to set `page=9`.
|
1336
1444
|
|
1337
1445
|
#### hitsPerPage
|
1338
1446
|
|
1339
1447
|
- scope: `settings` `search`
|
1340
|
-
- type:
|
1341
|
-
- default: 20
|
1448
|
+
- type: integer
|
1449
|
+
- default: `20`
|
1342
1450
|
|
1343
|
-
|
1451
|
+
Maximum number of hits per page.
|
1344
1452
|
|
1345
1453
|
#### offset
|
1346
1454
|
|
1347
1455
|
- scope: `search`
|
1348
|
-
- type:
|
1456
|
+
- type: integer
|
1457
|
+
- default: `null`
|
1349
1458
|
|
1350
1459
|
Offset of the first hit to return (zero-based).
|
1351
1460
|
|
1352
|
-
**
|
1461
|
+
**Note:** In most cases, [page](#page)/[hitsPerPage](#hitsperpage) is the recommended method for pagination.
|
1353
1462
|
|
1354
1463
|
#### length
|
1355
1464
|
|
1356
1465
|
- scope: `search`
|
1357
|
-
- type:
|
1466
|
+
- type: integer
|
1467
|
+
- default: `null`
|
1358
1468
|
|
1359
|
-
|
1469
|
+
Maximum number of hits to return.
|
1360
1470
|
|
1361
|
-
**
|
1471
|
+
**Note:** In most cases, [page](#page)/[hitsPerPage](#hitsperpage) is the recommended method for pagination.
|
1362
1472
|
|
1363
1473
|
#### paginationLimitedTo
|
1364
1474
|
|
1365
1475
|
- scope: `settings`
|
1366
|
-
- type:
|
1367
|
-
- default: 1000
|
1476
|
+
- type: integer
|
1477
|
+
- default: `1000`
|
1368
1478
|
|
1369
|
-
|
1370
|
-
By default, this parameter is
|
1479
|
+
Maximum number of hits accessible via pagination.
|
1480
|
+
By default, this parameter is set to 1000 to guarantee good performance.
|
1371
1481
|
|
1372
|
-
**
|
1373
|
-
Increasing
|
1374
|
-
A
|
1482
|
+
**Caution:** We recommend keeping the default value to guarantee excellent performance.
|
1483
|
+
Increasing the pagination limit will have a direct impact on the performance of search queries.
|
1484
|
+
A too high value will also make it very easy for anyone to retrieve ("scrape") your entire dataset.
|
1375
1485
|
|
1376
1486
|
## Typos
|
1377
1487
|
|
1378
1488
|
#### minWordSizefor1Typo
|
1379
1489
|
|
1380
1490
|
- scope: `settings` `search`
|
1381
|
-
- type:
|
1382
|
-
- default: 4
|
1491
|
+
- type: integer
|
1492
|
+
- default: `4`
|
1383
1493
|
|
1384
|
-
|
1494
|
+
Minimum number of characters a word in the query string must contain to accept matches with one typo.
|
1385
1495
|
|
1386
1496
|
#### minWordSizefor2Typos
|
1387
1497
|
|
1388
1498
|
- scope: `settings` `search`
|
1389
|
-
- type:
|
1390
|
-
- default: 8
|
1499
|
+
- type: integer
|
1500
|
+
- default: `8`
|
1391
1501
|
|
1392
|
-
|
1502
|
+
Minimum number of characters a word in the query string must contain to accept matches with two typos.
|
1393
1503
|
|
1394
1504
|
#### typoTolerance
|
1395
1505
|
|
1396
1506
|
- scope: `settings` `search`
|
1397
|
-
- type:
|
1398
|
-
- default: true
|
1507
|
+
- type: string \| boolean
|
1508
|
+
- default: `true`
|
1399
1509
|
|
1400
|
-
|
1510
|
+
Controls whether typo tolerance is enabled and how it is applied:
|
1401
1511
|
|
1402
1512
|
* `true`:
|
1403
|
-
|
1513
|
+
Typo tolerance is enabled and all matching hits are retrieved (default behavior).
|
1404
1514
|
|
1405
1515
|
* `false`:
|
1406
|
-
|
1516
|
+
Typo tolerance is entirely disabled. Hits matching with only typos are not retrieved.
|
1407
1517
|
|
1408
1518
|
* `min`:
|
1409
|
-
Only keep results with the minimum number of typos. For example, if one
|
1519
|
+
Only keep results with the minimum number of typos. For example, if just one hit matches without typos, then all hits with only typos are not retrieved.
|
1410
1520
|
|
1411
1521
|
* `strict`:
|
1412
|
-
Hits matching with 2 typos or more are not retrieved if there are some matching without typos.
|
1413
|
-
This option is useful
|
1522
|
+
Hits matching with 2 typos or more are not retrieved if there are some hits matching without typos.
|
1523
|
+
This option is useful to avoid "false positives" as much as possible.
|
1414
1524
|
|
1415
1525
|
#### allowTyposOnNumericTokens
|
1416
1526
|
|
1417
1527
|
- scope: `settings` `search`
|
1418
|
-
- type:
|
1419
|
-
- default: true
|
1528
|
+
- type: boolean
|
1529
|
+
- default: `true`
|
1420
1530
|
|
1421
|
-
|
1422
|
-
For example the query `\"304\"` will match with `\"30450\"`, but not with `\"40450\"`
|
1423
|
-
that would have been the case with typo-tolerance enabled.
|
1531
|
+
Whether to allow typos on numbers ("numeric tokens") in the query string.
|
1424
1532
|
|
1425
|
-
|
1533
|
+
When false, typo tolerance is disabled on numeric tokens.
|
1534
|
+
For example, the query `304` will match `30450` but not `40450`
|
1535
|
+
(which would have been the case with typo tolerance enabled).
|
1536
|
+
|
1537
|
+
**Note:** This option can be very useful on serial numbers and zip codes searches.
|
1426
1538
|
|
1427
1539
|
#### ignorePlurals
|
1428
1540
|
|
1429
1541
|
- scope: `settings` `search`
|
1430
|
-
- type:
|
1431
|
-
- default:
|
1542
|
+
- type: boolean \| array of strings
|
1543
|
+
- default: `false`
|
1432
1544
|
|
1433
1545
|
Consider singular and plurals forms a match without typo.
|
1434
|
-
For example, car and cars, or foot and feet will be considered equivalent.
|
1546
|
+
For example, "car" and "cars", or "foot" and "feet" will be considered equivalent.
|
1435
1547
|
|
1436
|
-
This parameter
|
1548
|
+
This parameter may be:
|
1437
1549
|
|
1438
|
-
- a **boolean**: enable or disable plurals for all
|
1550
|
+
- a **boolean**: enable or disable plurals for all supported languages;
|
1439
1551
|
- a **list of language ISO codes** for which plurals should be enabled.
|
1440
1552
|
|
1441
1553
|
This option is set to `false` by default.
|
1442
1554
|
|
1443
|
-
|
1555
|
+
List of supported languages with their associated ISO code:
|
1444
1556
|
|
1445
1557
|
Afrikaans=`af`, Arabic=`ar`, Azeri=`az`, Bulgarian=`bg`, Catalan=`ca`,
|
1446
1558
|
Czech=`cs`, Welsh=`cy`, Danis=`da`, German=`de`, English=`en`,
|
@@ -1452,32 +1564,32 @@ Lithuanian=`lt`, Maori=`mi`, Mongolian=`mn`, Marathi=`mr`, Malay=`ms`,
|
|
1452
1564
|
Maltese=`mt`, Norwegian=`nb`, Dutch=`nl`, Northern Sotho=`ns`, Polish=`pl`,
|
1453
1565
|
Pashto=`ps`, Portuguese=`pt`, Quechua=`qu`, Romanian=`ro`, Russian=`ru`,
|
1454
1566
|
Slovak=`sk`, Albanian=`sq`, Swedish=`sv`, Swahili=`sw`, Tamil=`ta`,
|
1455
|
-
Telugu=`te`, Tagalog=`tl`, Tswana=`tn`, Turkish=`tr`, Tatar=`tt
|
1567
|
+
Telugu=`te`, Tagalog=`tl`, Tswana=`tn`, Turkish=`tr`, Tatar=`tt`
|
1456
1568
|
|
1457
1569
|
#### disableTypoToleranceOnAttributes
|
1458
1570
|
|
1459
1571
|
- scope: `settings` `search`
|
1460
|
-
- type:
|
1461
|
-
- default: []
|
1572
|
+
- type: array of strings
|
1573
|
+
- default: `[]`
|
1462
1574
|
|
1463
1575
|
List of attributes on which you want to disable typo tolerance
|
1464
|
-
(must be a subset of the
|
1576
|
+
(must be a subset of the [searchableAttributes](#searchableattributes) index setting).
|
1465
1577
|
|
1466
1578
|
#### disableTypoToleranceOnWords
|
1467
1579
|
|
1468
1580
|
- scope: `settings`
|
1469
|
-
- type:
|
1470
|
-
- default: []
|
1581
|
+
- type: array of strings
|
1582
|
+
- default: `[]`
|
1471
1583
|
|
1472
|
-
|
1584
|
+
List of words on which typo tolerance will be disabled.
|
1473
1585
|
|
1474
1586
|
#### separatorsToIndex
|
1475
1587
|
|
1476
1588
|
- scope: `settings`
|
1477
|
-
- type:
|
1478
|
-
- default: ""
|
1589
|
+
- type: string
|
1590
|
+
- default: `""`
|
1479
1591
|
|
1480
|
-
|
1592
|
+
Separators (punctuation characters) to index.
|
1481
1593
|
|
1482
1594
|
By default, separators are not indexed.
|
1483
1595
|
|
@@ -1487,7 +1599,7 @@ By default, separators are not indexed.
|
|
1487
1599
|
|
1488
1600
|
Geo search requires that you provide at least one geo location in each record at indexing time, under the `_geoloc` attribute. Each location must be an object with two numeric `lat` and `lng` attributes. You may specify either one location:
|
1489
1601
|
|
1490
|
-
```
|
1602
|
+
```json
|
1491
1603
|
{
|
1492
1604
|
"_geoloc": {
|
1493
1605
|
"lat": 48.853409,
|
@@ -1498,7 +1610,7 @@ Geo search requires that you provide at least one geo location in each record at
|
|
1498
1610
|
|
1499
1611
|
... or an array of locations:
|
1500
1612
|
|
1501
|
-
```
|
1613
|
+
```json
|
1502
1614
|
{
|
1503
1615
|
"_geoloc": [
|
1504
1616
|
{
|
@@ -1513,130 +1625,151 @@ Geo search requires that you provide at least one geo location in each record at
|
|
1513
1625
|
}
|
1514
1626
|
```
|
1515
1627
|
|
1628
|
+
When performing a geo search (either via [aroundLatLng](#aroundlatlng) or [aroundLatLngViaIP](#aroundlatlngviaip)),
|
1629
|
+
the maximum distance is automatically guessed based on the density of the searched area.
|
1630
|
+
You may explicitly specify a maximum distance, however, via [aroundRadius](#aroundradius).
|
1631
|
+
|
1632
|
+
The precision for the ranking is set via [aroundPrecision](#aroundprecision).
|
1633
|
+
|
1516
1634
|
#### aroundLatLng
|
1517
1635
|
|
1518
1636
|
- scope: `search`
|
1519
|
-
- type:
|
1520
|
-
- default:
|
1637
|
+
- type: (latitude, longitude) pair
|
1638
|
+
- default: `null`
|
1521
1639
|
|
1522
1640
|
Search for entries around a given location (specified as two floats separated by a comma).
|
1523
1641
|
|
1524
1642
|
For example, `aroundLatLng=47.316669,5.016670`.
|
1525
1643
|
|
1526
|
-
|
1527
|
-
but you can specify it manually in meters with the **aroundRadius** parameter.
|
1528
|
-
The precision for ranking can be set with **aroundPrecision** parameter.
|
1529
|
-
- If you set aroundPrecision=100, the distances will be considered by ranges of 100m.
|
1530
|
-
- For example all distances 0 and 100m will be considered as identical for the "geo" ranking parameter.
|
1644
|
+
<!-- TODO: Only document serialization format for the REST API. -->
|
1531
1645
|
|
1532
1646
|
#### aroundLatLngViaIP
|
1533
1647
|
|
1534
1648
|
- scope: `search`
|
1535
|
-
- type:
|
1536
|
-
- default: false
|
1649
|
+
- type: boolean
|
1650
|
+
- default: `false`
|
1537
1651
|
|
1538
|
-
Search for entries around a given
|
1652
|
+
Search for entries around a given location automatically computed from the requester's IP address.
|
1539
1653
|
|
1540
|
-
|
1541
|
-
|
1542
|
-
You can specify the maximum distance in meters with the `aroundRadius` parameter
|
1543
|
-
and the precision for ranking with `aroundPrecision`.
|
1544
|
-
|
1545
|
-
For example:
|
1546
|
-
- if you set aroundPrecision=100,
|
1547
|
-
two objects that are in the range 0-99m
|
1548
|
-
will be considered as identical in the ranking for the "geo" ranking parameter (same for 100-199, 200-299, ... ranges).
|
1654
|
+
**Warning:** If you are sending the request from your servers, you must set the `X-Forwarded-For` HTTP header with the client's IP
|
1655
|
+
address for it to be used as the basis for the computation of the search location.
|
1549
1656
|
|
1550
1657
|
#### aroundRadius
|
1551
1658
|
|
1552
1659
|
- scope: `search`
|
1553
|
-
- type:
|
1660
|
+
- type: integer \| `"all"`
|
1661
|
+
- default: `null`
|
1554
1662
|
|
1555
|
-
|
1663
|
+
Maximum radius for geo search (in meters).
|
1556
1664
|
|
1557
|
-
If
|
1558
|
-
You can retrieve the computed radius in the `automaticRadius` attribute of the response.
|
1559
|
-
You can also specify a minimum value for the automatic radius by using the `minimumAroundRadius` query parameter.
|
1665
|
+
If set, only hits within the specified radius from the searched location will be returned.
|
1560
1666
|
|
1561
|
-
|
1562
|
-
|
1667
|
+
If not set, the radius is automatically computed from the density of the searched area.
|
1668
|
+
You can retrieve the computed radius in the `automaticRadius` response field.
|
1669
|
+
You may also specify a minimum value for the automatic radius via [minimumAroundRadius](#minimumaroundradius).
|
1670
|
+
|
1671
|
+
The special value `all` causes the geo distance to be computed and taken into account for ranking, but without filtering;
|
1672
|
+
this option is faster than specifying a high integer value.
|
1563
1673
|
|
1564
1674
|
#### aroundPrecision
|
1565
1675
|
|
1566
1676
|
- scope: `search`
|
1567
|
-
- type:
|
1677
|
+
- type: integer
|
1678
|
+
- default: `1`
|
1679
|
+
|
1680
|
+
Precision of geo search (in meters).
|
1568
1681
|
|
1569
|
-
|
1570
|
-
|
1682
|
+
When ranking hits, geo distances are grouped into ranges of `aroundPrecision` size. All hits within the same range
|
1683
|
+
are considered equal with respect to the `geo` ranking parameter.
|
1571
1684
|
|
1572
|
-
For example, if you set `aroundPrecision
|
1573
|
-
|
1685
|
+
For example, if you set `aroundPrecision` to `100`, any two objects lying in the range `[0, 99m]` from the searched
|
1686
|
+
location will be considered equal; same for `[100, 199]`, `[200, 299]`, etc.
|
1574
1687
|
|
1575
1688
|
#### minimumAroundRadius
|
1576
1689
|
|
1577
1690
|
- scope: `search`
|
1578
|
-
- type:
|
1691
|
+
- type: integer
|
1692
|
+
- default: `null`
|
1579
1693
|
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1694
|
+
Minimum radius used for a geo search when [aroundRadius](#aroundradius) is not set.
|
1695
|
+
|
1696
|
+
**Note:** This parameter is ignored when `aroundRadius` is set.
|
1583
1697
|
|
1584
1698
|
#### insideBoundingBox
|
1585
1699
|
|
1586
1700
|
- scope: `search`
|
1587
|
-
- type:
|
1701
|
+
- type: geo rectangle(s)
|
1702
|
+
- default: `null`
|
1703
|
+
|
1704
|
+
Search inside a rectangular area (in geo coordinates).
|
1588
1705
|
|
1589
|
-
|
1590
|
-
|
1706
|
+
The rectange is defined by two diagonally opposite points (hereafter `p1` and `p2`),
|
1707
|
+
hence by 4 floats: `p1Lat`, `p1Lng`, `p2Lat`, `p2Lng`.
|
1591
1708
|
|
1592
1709
|
For example:
|
1593
1710
|
|
1594
|
-
|
1711
|
+
`insideBoundingBox=47.3165,4.9665,47.3424,5.0201`
|
1595
1712
|
|
1596
|
-
You
|
1597
|
-
|
1713
|
+
You may specify multiple bounding boxes, in which case the search will use the **union** (OR) of the rectangles.
|
1714
|
+
To specify multiple rectangles, pass either:
|
1715
|
+
|
1716
|
+
- more than 4 values (must be a multiple of 4: 8, 12...);
|
1717
|
+
example: `47.3165,4.9665,47.3424,5.0201,40.9234,2.1185,38.6430,1.9916`; or
|
1718
|
+
- an array of arrays of floats (each inner array must contain exactly 4 values);
|
1719
|
+
example: `[[47.3165, 4.9665, 47.3424, 5.0201], [40.9234, 2.1185, 38.6430, 1.9916]`.
|
1598
1720
|
|
1599
1721
|
#### insidePolygon
|
1600
1722
|
|
1601
1723
|
- scope: `search`
|
1602
|
-
- type:
|
1603
|
-
- default:
|
1724
|
+
- type: geo polygon(s)
|
1725
|
+
- default: `null`
|
1604
1726
|
|
1605
|
-
Search
|
1606
|
-
(defined by a minimum of 6 floats: p1Lat,p1Lng,p2Lat,p2Lng,p3Lat,p3Long).
|
1727
|
+
Search inside a polygon (in geo coordinates).
|
1607
1728
|
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1729
|
+
The polygon is defined by a set of points (minimum 3), each defined by its latitude and longitude.
|
1730
|
+
You therefore need an even number of floats, with a minimum of 6: `p1Lat`, `p1Lng`, `p2Lat`, `p2Lng`, `p3Lat`, `p3Long`.
|
1731
|
+
|
1732
|
+
For example:
|
1733
|
+
|
1734
|
+
`insidePolygon=47.3165,4.9665,47.3424,5.0201,47.32,4.98`
|
1735
|
+
|
1736
|
+
You may specify multiple polygons, in which case the search will use the **union** (OR) of the polygons.
|
1737
|
+
To specify multiple polygons, pass an array of arrays of floats (each inner array must contain an even number of
|
1738
|
+
values, with a minimum of 6);
|
1739
|
+
example: `[[47.3165, 4.9665, 47.3424, 5.0201, 47.32, 4.9], [40.9234, 2.1185, 38.6430, 1.9916, 39.2587, 2.0104]]`.
|
1612
1740
|
|
1613
1741
|
## Query Strategy
|
1614
1742
|
|
1615
1743
|
#### queryType
|
1616
1744
|
|
1617
|
-
- scope: `settings`
|
1618
|
-
- type:
|
1619
|
-
- default: prefixLast
|
1745
|
+
- scope: `search` `settings`
|
1746
|
+
- type: string
|
1747
|
+
- default: `"prefixLast"`
|
1620
1748
|
|
1621
|
-
|
1749
|
+
Controls if and how query words are interpreted as prefixes.
|
1750
|
+
|
1751
|
+
It may be one of the following values:
|
1622
1752
|
|
1623
1753
|
* `prefixLast`:
|
1624
1754
|
Only the last word is interpreted as a prefix (default behavior).
|
1625
1755
|
|
1626
1756
|
* `prefixAll`:
|
1627
|
-
All query words are interpreted as prefixes. This option is not recommended
|
1757
|
+
All query words are interpreted as prefixes. This option is not recommended, as it tends to yield counterintuitive
|
1758
|
+
results and has a negative impact on performance.
|
1628
1759
|
|
1629
1760
|
* `prefixNone`:
|
1630
|
-
No query word is interpreted as a prefix. This option is not recommended
|
1761
|
+
No query word is interpreted as a prefix. This option is not recommended, especially in an instant search setup,
|
1762
|
+
as the user will have to type the entire word(s) before getting any relevant results.
|
1631
1763
|
|
1632
1764
|
#### removeWordsIfNoResults
|
1633
1765
|
|
1634
1766
|
- scope: `settings` `search`
|
1635
|
-
- type:
|
1636
|
-
- default: none
|
1767
|
+
- type: string
|
1768
|
+
- default: `"none"`
|
1769
|
+
|
1770
|
+
Selects a strategy to remove words from the query when it doesn't match any hits.
|
1637
1771
|
|
1638
|
-
|
1639
|
-
It can be used to avoid having an empty result page
|
1772
|
+
The goal is to avoid empty results by progressively loosening the query until hits are matched.
|
1640
1773
|
|
1641
1774
|
There are four different options:
|
1642
1775
|
|
@@ -1644,77 +1777,96 @@ There are four different options:
|
|
1644
1777
|
No specific processing is done when a query does not return any results (default behavior).
|
1645
1778
|
|
1646
1779
|
- `lastWords`:
|
1647
|
-
When a query does not return any results, the last word
|
1648
|
-
The process is repeated with
|
1780
|
+
When a query does not return any results, treat the last word as optional.
|
1781
|
+
The process is repeated with words N-1, N-2, etc. until there are results, or the beginning of the query string has been reached.
|
1649
1782
|
|
1650
1783
|
- `firstWords`:
|
1651
|
-
When a query does not return any results, the first word
|
1652
|
-
The process is repeated with
|
1784
|
+
When a query does not return any results, treat the first word as optional.
|
1785
|
+
The process is repeated with words 2, 3, etc. until there are results, or the end of the query string has been reached.
|
1786
|
+
|
1653
1787
|
- `allOptional`:
|
1654
|
-
When a query does not return any results, a second
|
1655
|
-
This is equivalent to transforming the AND
|
1788
|
+
When a query does not return any results, make a second attempt treating all words as optional.
|
1789
|
+
This is equivalent to transforming the implicit AND operator applied between query words to an OR.
|
1656
1790
|
|
1657
1791
|
#### advancedSyntax
|
1658
1792
|
|
1659
1793
|
- scope: `settings` `search`
|
1660
|
-
- type:
|
1661
|
-
- default: false
|
1794
|
+
- type: boolean
|
1795
|
+
- default: `false`
|
1662
1796
|
|
1663
1797
|
Enables the advanced query syntax.
|
1664
1798
|
|
1665
|
-
This syntax
|
1799
|
+
This advanced syntax brings two additional features:
|
1666
1800
|
|
1667
|
-
- **Phrase query**:
|
1668
|
-
|
1801
|
+
- **Phrase query**: a specific sequence of terms that must be matched next to one another.
|
1802
|
+
A phrase query needs to be surrounded by double quotes (`"`).
|
1803
|
+
For example, `"search engine"` will only match records having `search` next to `engine`.
|
1669
1804
|
|
1670
|
-
Typo tolerance is disabled inside the phrase (
|
1805
|
+
Typo tolerance is disabled inside the phrase (i.e. within the quotes).
|
1671
1806
|
|
1672
1807
|
|
1673
|
-
- **Prohibit operator**:
|
1674
|
-
|
1808
|
+
- **Prohibit operator**: excludes records that contain a specific term.
|
1809
|
+
This term has to be prefixed by a minus (`-`, a.k.a dash).
|
1810
|
+
For example, `search -engine` will only match records containing `search` but not `engine`.
|
1675
1811
|
|
1676
1812
|
#### optionalWords
|
1677
1813
|
|
1678
1814
|
- scope: `settings` `search`
|
1679
|
-
- type:
|
1680
|
-
- default:
|
1815
|
+
- type: string \| array of strings
|
1816
|
+
- default: `[]`
|
1681
1817
|
|
1682
|
-
|
1818
|
+
List of words that should be considered as optional when found in the query.
|
1683
1819
|
|
1684
|
-
|
1685
|
-
|
1820
|
+
This parameter can be useful when you want to do an **OR** between all words of the query.
|
1821
|
+
To do that you can set optionalWords equals to the search query.
|
1822
|
+
|
1823
|
+
```js
|
1824
|
+
var query = 'the query';
|
1825
|
+
var params = {'optionalWords': query};
|
1826
|
+
```
|
1827
|
+
|
1828
|
+
**Note:** You don't need to put commas between words.
|
1829
|
+
Each string will automatically be tokenized into words, all of which will be considered as optional.
|
1686
1830
|
|
1687
1831
|
#### removeStopWords
|
1688
1832
|
|
1689
1833
|
- scope: `settings` `search`
|
1690
|
-
- type:
|
1691
|
-
- default: false
|
1834
|
+
- type: boolean \| array of strings
|
1835
|
+
- default: `false`
|
1692
1836
|
|
1693
|
-
Remove stop words from the query **before** executing it.
|
1837
|
+
Remove stop words from the query **before** executing it.
|
1694
1838
|
|
1695
|
-
|
1696
|
-
- a **list of language ISO codes** (as a comma-separated string) for which stop words should be enabled.
|
1839
|
+
This parameter may be:
|
1697
1840
|
|
1698
|
-
|
1841
|
+
- a **boolean**: enable or disable stop words for all supported languages; or
|
1842
|
+
- a **list of language ISO codes** for which stop word removal should be enabled.
|
1699
1843
|
|
1700
|
-
|
1844
|
+
**Warning:** In most use-cases, **we don't recommend enabling stop word removal**.
|
1701
1845
|
|
1702
|
-
Stop
|
1846
|
+
Stop word removal is useful when you have a query in natural language, e.g. "what is a record?".
|
1847
|
+
In that case, the engine will remove "what", "is" and "a" before executing the query, and therefore just search for "record".
|
1848
|
+
This will remove false positives caused by stop words, especially when combined with optional words
|
1849
|
+
(see [optionalWords](#optionalwords) and [removeWordsIfNoResults](#removewordsifnoresults)).
|
1850
|
+
For most use cases, however, it is better not to use this feature, as people tend to search by keywords on search engines
|
1851
|
+
(i.e. they naturally omit stop words).
|
1703
1852
|
|
1704
|
-
|
1705
|
-
* `queryType=prefixNone` means no query word are prefix, stop words removal will be applied on all query words
|
1706
|
-
* `queryType=prefixAll` means all query terms are prefix, stop words won’t be removed
|
1853
|
+
**Note:** Stop words removal is only applied on query words that are *not* interpreted as prefixes.
|
1707
1854
|
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1855
|
+
As a consequence, the behavior of `removeStopWords` also depends on the [queryType](#querytype) parameter:
|
1856
|
+
|
1857
|
+
* `queryType=prefixLast` means the last query word is a prefix and won't be considered for stop word removal;
|
1858
|
+
* `queryType=prefixNone` means no query word is a prefix, therefore stop word removal will be applied to all query words;
|
1859
|
+
* `queryType=prefixAll` means all query words are prefixes, therefore no stop words will be removed.
|
1860
|
+
|
1861
|
+
List of supported languages with their associated ISO code:
|
1862
|
+
|
1863
|
+
Arabic=`ar`, Armenian=`hy`, Basque=`eu`, Bengali=`bn`, Brazilian=`pt-br`, Bulgarian=`bg`, Catalan=`ca`, Chinese=`zh`, Czech=`cs`, Danish=`da`, Dutch=`nl`, English=`en`, Finnish=`fi`, French=`fr`, Galician=`gl`, German=`de`, Greek=`el`, Hindi=`hi`, Hungarian=`hu`, Indonesian=`id`, Irish=`ga`, Italian=`it`, Japanese=`ja`, Korean=`ko`, Kurdish=`ku`, Latvian=`lv`, Lithuanian=`lt`, Marathi=`mr`, Norwegian=`no`, Persian (Farsi)=`fa`, Polish=`pl`, Portugese=`pt`, Romanian=`ro`, Russian=`ru`, Slovak=`sk`, Spanish=`es`, Swedish=`sv`, Thai=`th`, Turkish=`tr`, Ukranian=`uk`, Urdu=`ur`.
|
1712
1864
|
|
1713
1865
|
#### disablePrefixOnAttributes
|
1714
1866
|
|
1715
|
-
- scope: `
|
1716
|
-
- type:
|
1717
|
-
- default: []
|
1867
|
+
- scope: `settings`
|
1868
|
+
- type: array of strings
|
1869
|
+
- default: `[]`
|
1718
1870
|
|
1719
1871
|
List of attributes on which you want to disable prefix matching
|
1720
1872
|
(must be a subset of the `searchableAttributes` index setting).
|
@@ -1725,90 +1877,256 @@ This setting is useful on attributes that contain string that should not be matc
|
|
1725
1877
|
#### disableExactOnAttributes
|
1726
1878
|
|
1727
1879
|
- scope: `settings`
|
1728
|
-
- type:
|
1729
|
-
- default: []
|
1880
|
+
- type: search
|
1881
|
+
- default: `[]`
|
1730
1882
|
|
1731
|
-
List of attributes on which you want to disable
|
1883
|
+
List of attributes on which you want to disable computation of the `exact` ranking criterion
|
1732
1884
|
(must be a subset of the `searchableAttributes` index setting).
|
1733
1885
|
|
1734
1886
|
#### exactOnSingleWordQuery
|
1735
1887
|
|
1736
1888
|
- scope: `settings` `search`
|
1737
|
-
- type:
|
1738
|
-
- default: attribute
|
1889
|
+
- type: string
|
1890
|
+
- default: `attribute`
|
1739
1891
|
|
1740
|
-
|
1892
|
+
Controls how the `exact` ranking criterion is computed when the query contains only one word.
|
1741
1893
|
|
1742
|
-
|
1743
|
-
|
1744
|
-
* `
|
1894
|
+
The following values are allowed:
|
1895
|
+
|
1896
|
+
* `none`: the `exact` ranking criterion is ignored on single word queries;
|
1897
|
+
* `word`: the `exact` ranking criterion is set to 1 if the query word is found in the record.
|
1898
|
+
The query word must be at least 3 characters long and must not be a stop word in any supported language.
|
1899
|
+
* `attribute` (default): the `exact` ranking criterion is set to 1 if the query string exactly matches an entire attribute value.
|
1900
|
+
For example, if you search for the TV show "V", you want it to match the query "V" *before* all popular TV shows starting with the letter V.
|
1745
1901
|
|
1746
1902
|
#### alternativesAsExact
|
1747
1903
|
|
1748
1904
|
- scope: `setting` `search`
|
1749
|
-
- type:
|
1750
|
-
- default: [
|
1905
|
+
- type: array of strings
|
1906
|
+
- default: `["ignorePlurals", "singleWordSynonym"]`
|
1907
|
+
|
1908
|
+
List of alternatives that should be considered an exact match by the `exact` ranking criterion.
|
1751
1909
|
|
1752
|
-
|
1910
|
+
The following values are allowed:
|
1753
1911
|
|
1754
|
-
* `ignorePlurals`: alternative words added by the ignorePlurals feature
|
1755
|
-
* `singleWordSynonym`: single-word
|
1756
|
-
* `multiWordsSynonym`: multiple-words
|
1912
|
+
* `ignorePlurals`: alternative words added by the [ignorePlurals](#ignoreplurals) feature;
|
1913
|
+
* `singleWordSynonym`: single-word synonyms (example: "NY" = "NYC");
|
1914
|
+
* `multiWordsSynonym`: multiple-words synonyms (example: "NY" = "New York").
|
1757
1915
|
|
1758
|
-
##
|
1916
|
+
## Performance
|
1759
1917
|
|
1760
1918
|
#### numericAttributesForFiltering
|
1761
1919
|
|
1762
1920
|
- scope: `settings`
|
1763
|
-
- type:
|
1764
|
-
- default:
|
1921
|
+
- type: array of strings
|
1922
|
+
- default: all numeric attributes
|
1765
1923
|
- formerly known as: `numericAttributesToIndex`
|
1766
1924
|
|
1767
|
-
|
1768
|
-
|
1769
|
-
If
|
1770
|
-
|
1925
|
+
List of numeric attributes that can be used as numerical filters.
|
1926
|
+
|
1927
|
+
If not specified, all numeric attributes are automatically indexed and available as numerical filters
|
1928
|
+
(via the [filters](#filters) parameter).
|
1929
|
+
If specified, only attributes explicitly listed are available as numerical filters.
|
1930
|
+
If empty, no numerical filters are allowed.
|
1931
|
+
|
1932
|
+
If you don't need filtering on some of your numerical attributes, you can use `numericAttributesForFiltering` to
|
1933
|
+
speed up the indexing.
|
1771
1934
|
|
1772
|
-
If you only need to filter on a numeric value with the
|
1773
|
-
you can speed up the indexing by specifying
|
1774
|
-
|
1935
|
+
If you only need to filter on a numeric value based on equality (i.e. with the operators `=` or `!=`),
|
1936
|
+
you can speed up the indexing by specifying `equalOnly(${attributeName})`.
|
1937
|
+
Other operators will be disabled.
|
1775
1938
|
|
1776
1939
|
#### allowCompressionOfIntegerArray
|
1777
1940
|
|
1778
1941
|
- scope: `settings`
|
1779
|
-
- type:
|
1780
|
-
- default: false
|
1942
|
+
- type: boolean
|
1943
|
+
- default: `false`
|
1781
1944
|
|
1782
|
-
|
1945
|
+
Enables compression of large integer arrays.
|
1783
1946
|
|
1784
|
-
In data-intensive use-cases,
|
1785
|
-
|
1786
|
-
|
1947
|
+
In data-intensive use-cases, we recommended enabling this feature to reach a better compression ratio on arrays
|
1948
|
+
exclusively containing integers (as is typical of lists of user IDs or ACLs).
|
1949
|
+
|
1950
|
+
**Note:** When enabled, integer arrays may be reordered.
|
1787
1951
|
|
1788
1952
|
## Advanced
|
1789
1953
|
|
1790
1954
|
#### attributeForDistinct
|
1791
1955
|
|
1792
1956
|
- scope: `settings`
|
1793
|
-
- type:
|
1957
|
+
- type: string
|
1958
|
+
- default: `null`
|
1959
|
+
|
1960
|
+
Name of the de-duplication attribute for the [distinct](#distinct) feature.
|
1961
|
+
|
1962
|
+
#### distinct
|
1963
|
+
|
1964
|
+
- scope: `settings` `search`
|
1965
|
+
- type: integer \| boolean
|
1966
|
+
- default: `0`
|
1967
|
+
|
1968
|
+
Controls de-duplication of results.
|
1969
|
+
|
1970
|
+
A non-zero value enables de-duplication; a zero value disables it.
|
1971
|
+
Booleans are also accepted (though not recommended): false is treated as 0, and true is treated as 1.
|
1972
|
+
|
1973
|
+
**Note:** De-duplication requires a **de-duplication attribute** to be configured via the [attributeForDistinct](#attributefordistinct) index setting.
|
1974
|
+
If not configured, `distinct` will be accepted at query time but silently ignored.
|
1975
|
+
|
1976
|
+
This feature is similar to the SQL `distinct` keyword. When set to N (where N > 0), at most N hits will be returned
|
1977
|
+
with the same value for the de-duplication attribute.
|
1978
|
+
|
1979
|
+
**Example:** If the de-duplication attribute is `show_name` and `distinct` is set to 1, then if several hits have the
|
1980
|
+
same value for `show_name`, only the most relevant one is kept (with respect to the ranking formula); the others are removed.
|
1981
|
+
|
1982
|
+
To get a full understanding of how `distinct` works,
|
1983
|
+
you can have a look at our [Guides](https://www.algolia.com/doc/guides/search/distinct).
|
1984
|
+
|
1985
|
+
#### getRankingInfo
|
1986
|
+
|
1987
|
+
- scope: `search`
|
1988
|
+
- type: boolean
|
1989
|
+
- default: `false`
|
1990
|
+
|
1991
|
+
Enables detailed ranking information.
|
1992
|
+
|
1993
|
+
When true, each hit in the response contains an additional `_rankingInfo` object containing the following fields:
|
1794
1994
|
|
1795
|
-
|
1995
|
+
<!-- TODO: Factorize this list with the Search Response Format section. -->
|
1796
1996
|
|
1797
|
-
|
1798
|
-
When enabled in queries with the `distinct=1` parameter,
|
1799
|
-
all hits containing a duplicate value for this attribute are removed from the results.
|
1997
|
+
- `nbTypos` (integer): Number of typos encountered when matching the record. Corresponds to the `typos` ranking criterion in the ranking formula.
|
1800
1998
|
|
1801
|
-
|
1802
|
-
then only the first one is kept and the others are removed from the results.
|
1999
|
+
- `firstMatchedWord` (integer): Position of the most important matched attribute in the attributes to index list. Corresponds to the `attribute` ranking criterion in the ranking formula.
|
1803
2000
|
|
1804
|
-
|
1805
|
-
|
2001
|
+
- `proximityDistance` (integer): When the query contains more than one word, the sum of the distances between matched words. Corresponds to the `proximity` criterion in the ranking formula.
|
2002
|
+
|
2003
|
+
- `userScore` (integer): Custom ranking for the object, expressed as a single numerical value. Conceptually, it's what the position of the object would be in the list of all objects sorted by custom ranking. Corresponds to the `custom` criterion in the ranking formula.
|
2004
|
+
|
2005
|
+
- `geoDistance` (integer): Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision.
|
2006
|
+
|
2007
|
+
- `geoPrecision` (integer): Precision used when computed the geo distance, in meters. All distances will be floored to a multiple of this precision.
|
2008
|
+
|
2009
|
+
- `nbExactWords` (integer): Number of exactly matched words. If `alternativeAsExact` is set, it may include plurals and/or synonyms.
|
2010
|
+
|
2011
|
+
- `words` (integer): Number of matched words, including prefixes and typos.
|
2012
|
+
|
2013
|
+
- `filters` (integer): *This field is reserved for advanced usage.* It will be zero in most cases.
|
2014
|
+
|
2015
|
+
In addition, the response contains the following additional top-level fields:
|
2016
|
+
|
2017
|
+
- `serverUsed` (string): Actual host name of the server that processed the request. (Our DNS supports automatic failover and load balancing, so this may differ from the host name used in the request.)
|
2018
|
+
|
2019
|
+
- `parsedQuery` (string): The query string that will be searched, after normalization. Normalization includes removing stop words (if [removeStopWords](#removestopwords) is enabled), and transforming portions of the query string into phrase queries (see [advancedSyntax](#advancedsyntax)).
|
2020
|
+
|
2021
|
+
- `timeoutCounts` (boolean): Whether a timeout was hit when computing the facet counts. When `true`, the counts will be interpolated (i.e. approximate). See also `exhaustiveFacetsCount`.
|
2022
|
+
|
2023
|
+
- `timeoutHits` (boolean): Whether a timeout was hit when retrieving the hits. When true, some results may be missing.
|
2024
|
+
|
2025
|
+
#### numericFilters
|
2026
|
+
|
2027
|
+
- scope: `search`
|
2028
|
+
- type: array of strings
|
2029
|
+
- default: `[]`
|
2030
|
+
|
2031
|
+
Filter hits based on values of numeric attributes.
|
2032
|
+
|
2033
|
+
**Note:** The [filters](#filters) parameter provides an easier to use, SQL-like syntax.
|
2034
|
+
We recommend using it instead of `numericFilters`.
|
2035
|
+
|
2036
|
+
Each string represents a filter on a numeric attribute. Two forms are supported:
|
2037
|
+
|
2038
|
+
- **Comparison**: `${attributeName} ${operator} ${operand}` matches all objects where the specified numeric attribute satisfies the numeric condition expressed by the operator and the operand. The operand must be a numeric value. Supported operators are `<`, `<=`, `=`, `!=`, `>=` and `>`, with the same semantics as in virtually all programming languages.
|
2039
|
+
Example: `inStock > 0`.
|
2040
|
+
|
2041
|
+
- **Range**: `${attributeName}:${lowerBound} TO ${upperBound}` matches all objects where the specified numeric
|
2042
|
+
attribute is within the range [`${lowerBound}`, `${upperBound}`] \(inclusive on both ends).
|
2043
|
+
Example: `price: 0 TO 1000`.
|
2044
|
+
|
2045
|
+
If you specify multiple filters, they are interpreted as a conjunction (AND). If you want to use a disjunction (OR),
|
2046
|
+
use a nested array.
|
2047
|
+
|
2048
|
+
Examples:
|
2049
|
+
|
2050
|
+
- `["inStock > 0", "price < 1000"]` translates as `inStock > 0 AND price < 1000`
|
2051
|
+
- `[["inStock > 0", "deliveryDate < 1441755506"], "price < 1000"]` translates as `(inStock > 0 OR deliveryDate < 1441755506) AND price < 1000`
|
2052
|
+
|
2053
|
+
#### tagFilters
|
2054
|
+
|
2055
|
+
- scope: `search`
|
2056
|
+
- type: array of strings
|
2057
|
+
- default: `[]`
|
2058
|
+
|
2059
|
+
Filter hits by tags.
|
2060
|
+
|
2061
|
+
Tags must be contained in a top-level `_tags` attribute of your objects at indexing time.
|
2062
|
+
|
2063
|
+
**Note:** Tags are essentially an implicit facet on the `_tags` attribute.
|
2064
|
+
We therefore recommend that you use facets instead.
|
2065
|
+
See [attributesForFaceting](#attributesforfaceting) and [facets](#facets).
|
2066
|
+
|
2067
|
+
**Note:** The [filters](#filters) parameter provides an easier to use, SQL-like syntax.
|
2068
|
+
We recommend using it instead of `tagFilters`.
|
2069
|
+
|
2070
|
+
Each string represents a given tag value that must be matched.
|
2071
|
+
|
2072
|
+
If you specify multiple tags, they are interpreted as a conjunction (AND). If you want to use a disjunction (OR),
|
2073
|
+
use a nested array.
|
2074
|
+
|
2075
|
+
Examples:
|
2076
|
+
|
2077
|
+
- `["Book", "Movie"]` translates as `Book AND Movie`
|
2078
|
+
- `[["Book", "Movie"], "SciFi"]` translates as `(Book OR Movie) AND SciFi"`
|
2079
|
+
|
2080
|
+
Negation is supported by prefixing the tag value with a minus sign (`-`, a.k.a. dash).
|
2081
|
+
For example: `["tag1", "-tag2"]` translates as `tag1 AND NOT tag2`.
|
2082
|
+
|
2083
|
+
#### analytics
|
2084
|
+
|
2085
|
+
- scope: `search`
|
2086
|
+
- type: boolean
|
2087
|
+
- default: `true`
|
2088
|
+
|
2089
|
+
Whether the current query will be taken into account in the Analytics.
|
2090
|
+
|
2091
|
+
#### analyticsTags
|
2092
|
+
|
2093
|
+
- scope: `search`
|
2094
|
+
- type: array of strings
|
2095
|
+
- default: `[]`
|
2096
|
+
|
2097
|
+
List of tags to apply to the query in the Analytics.
|
2098
|
+
|
2099
|
+
Tags can be used in the Analytics to filter searches.
|
2100
|
+
|
2101
|
+
#### synonyms
|
2102
|
+
|
2103
|
+
- scope: `search`
|
2104
|
+
- type: boolean
|
2105
|
+
- default: `true`
|
2106
|
+
|
2107
|
+
Whether to take into account synonyms defined for the targeted index.
|
2108
|
+
|
2109
|
+
#### replaceSynonymsInHighlight
|
2110
|
+
|
2111
|
+
- scope: `settings` `search`
|
2112
|
+
- type: boolean
|
2113
|
+
- default: `true`
|
2114
|
+
|
2115
|
+
Whether to replace words matched via synonym expansion by the matched synonym in highlight and snippet results.
|
2116
|
+
|
2117
|
+
When true, highlighting and snippeting will use words from the query rather than the original words from the objects.
|
2118
|
+
When false, highlighting and snippeting will always display the original words from the objects.
|
2119
|
+
|
2120
|
+
**Note:** Multiple words can be replaced by a one-word synonym, but not the other way round.
|
2121
|
+
For example, if "NYC" and "New York City" are synonyms, searching for "NYC" will replace "New York City" with "NYC"
|
2122
|
+
in highlights and snippets, but searching for "New York City" will *not* replace "NYC" with "New York City" in
|
2123
|
+
highlights and snippets.
|
1806
2124
|
|
1807
2125
|
#### placeholders
|
1808
2126
|
|
1809
2127
|
- scope: `settings`
|
1810
|
-
- type:
|
1811
|
-
- default:
|
2128
|
+
- type: object of array of words
|
2129
|
+
- default: `{}`
|
1812
2130
|
|
1813
2131
|
This is an advanced use-case to define a token substitutable by a list of words
|
1814
2132
|
without having the original token searchable.
|
@@ -1829,8 +2147,8 @@ For example:
|
|
1829
2147
|
#### altCorrections
|
1830
2148
|
|
1831
2149
|
- scope: `settings`
|
1832
|
-
- type:
|
1833
|
-
- default: []
|
2150
|
+
- type: array of objects
|
2151
|
+
- default: `[]`
|
1834
2152
|
|
1835
2153
|
Specify alternative corrections that you want to consider.
|
1836
2154
|
|
@@ -1852,24 +2170,26 @@ For example:
|
|
1852
2170
|
#### minProximity
|
1853
2171
|
|
1854
2172
|
- scope: `settings` `search`
|
1855
|
-
- type:
|
1856
|
-
- default: 1
|
2173
|
+
- type: integer
|
2174
|
+
- default: `1`
|
1857
2175
|
|
1858
|
-
|
1859
|
-
By default, the minimum (and best) proximity value distance between 2 matching words is 1.
|
2176
|
+
Precision of the `proximity` ranking criterion.
|
1860
2177
|
|
1861
|
-
|
2178
|
+
By default, the minimum (and best) proximity value between two matching words is 1.
|
1862
2179
|
|
1863
|
-
|
1864
|
-
will get the same proximity score, even if the second contains a word between the two matching words.
|
2180
|
+
Setting it to 2 (respectively N) would allow 1 (respectively N-1) additional word(s) to be found between two matching words without degrading the proximity ranking value.
|
1865
2181
|
|
1866
|
-
**
|
2182
|
+
**Example:** considering the query *"javascript framework"*, if you set `minProximity` to 2,
|
2183
|
+
two records containing respectively *"JavaScript framework"* and *"JavaScript charting framework"*
|
2184
|
+
will get the same proximity score, even if the latter contains an additional word between the two matching words.
|
2185
|
+
|
2186
|
+
**Note:** The maximum value for `minProximity` is 7. Any higher value will **disable** the `proximity` criterion in the ranking formula.
|
1867
2187
|
|
1868
2188
|
#### responseFields
|
1869
2189
|
|
1870
2190
|
- scope: `settings` `search`
|
1871
|
-
- type:
|
1872
|
-
- default:
|
2191
|
+
- type: array of strings
|
2192
|
+
- default: `*` (all fields)
|
1873
2193
|
|
1874
2194
|
Choose which fields the response will contain. Applies to search and browse queries.
|
1875
2195
|
|
@@ -1878,9 +2198,9 @@ listed will be returned, unless `*` is used, in which case all fields are return
|
|
1878
2198
|
Specifying an empty list or unknown field names is an error.
|
1879
2199
|
|
1880
2200
|
This parameter is mainly intended to limit the response size.
|
1881
|
-
For example,
|
2201
|
+
For example, in complex queries, echoing of request parameters in the response's `params` field can be undesirable.
|
1882
2202
|
|
1883
|
-
|
2203
|
+
List of fields that can be filtered out:
|
1884
2204
|
|
1885
2205
|
- `aroundLatLng`
|
1886
2206
|
- `automaticRadius`
|
@@ -1900,119 +2220,16 @@ Here is the list of field that can be filtered:
|
|
1900
2220
|
- `query`
|
1901
2221
|
- `queryAfterRemoval`
|
1902
2222
|
|
1903
|
-
|
2223
|
+
List of fields that *cannot* be filtered out:
|
1904
2224
|
|
1905
2225
|
- `message`
|
1906
2226
|
- `warning`
|
1907
2227
|
- `cursor`
|
1908
2228
|
- `serverUsed`
|
1909
|
-
- `timeoutCounts`
|
1910
|
-
- `timeoutHits`
|
2229
|
+
- `timeoutCounts` (deprecated, please use `exhaustiveFacetsCount` instead)
|
2230
|
+
- `timeoutHits` (deprecated, please use `exhaustiveFacetsCount` instead)
|
1911
2231
|
- `parsedQuery`
|
1912
|
-
- fields triggered
|
1913
|
-
|
1914
|
-
#### distinct
|
1915
|
-
|
1916
|
-
- scope: `settings` `search`
|
1917
|
-
- type: `boolean`
|
1918
|
-
- default: 0
|
1919
|
-
|
1920
|
-
If set to 1 it
|
1921
|
-
enables the distinct feature, disabled by default, if the `attributeForDistinct` index setting is set.
|
1922
|
-
|
1923
|
-
This feature is similar to the SQL "distinct" keyword.
|
1924
|
-
When enabled in a query with the `distinct=1` parameter,
|
1925
|
-
all hits containing a duplicate value for the attributeForDistinct attribute are removed from results.
|
1926
|
-
|
1927
|
-
For example, if the chosen attribute is `show_name` and several hits have the same value for `show_name`,
|
1928
|
-
then only the best one is kept and the others are removed.
|
1929
|
-
|
1930
|
-
To get a full understanding of how `Distinct` works,
|
1931
|
-
you can have a look at our [guide on distinct](https://www.algolia.com/doc/search/distinct).
|
1932
|
-
|
1933
|
-
#### getRankingInfo
|
1934
|
-
|
1935
|
-
- scope: `search`
|
1936
|
-
- type: `boolean`
|
1937
|
-
- default: false
|
1938
|
-
|
1939
|
-
If set to true,
|
1940
|
-
the result hits will contain ranking information in the **_rankingInfo** attribute.
|
1941
|
-
|
1942
|
-
#### numericFilters
|
1943
|
-
|
1944
|
-
- scope: `search`
|
1945
|
-
- type: `array of strings`
|
1946
|
-
- default: []
|
1947
|
-
|
1948
|
-
*If you are not using this parameter to generate filters programatically you should use [filters](#filters) instead*
|
1949
|
-
|
1950
|
-
List of numeric filters you want to apply.
|
1951
|
-
The filter syntax is `attributeName` followed by `operand` followed by `value`.
|
1952
|
-
Supported operands are `<`, `<=`, `=`, `>` and `>=`.
|
1953
|
-
|
1954
|
-
You can easily perform range queries via the `:` operator.
|
1955
|
-
This is equivalent to combining a `>=` and `<=` operand.
|
1956
|
-
For example, `numericFilters=price:10 to 1000`.
|
1957
|
-
|
1958
|
-
You can also mix OR and AND operators.
|
1959
|
-
The OR operator is defined with a parenthesis syntax.
|
1960
|
-
For example, `code=1 AND (price:[0-100] OR price:[1000-2000])`
|
1961
|
-
translates to `code=1,(price:0 to 100,price:1000 to 2000)`.
|
1962
|
-
|
1963
|
-
#### tagFilters (deprecated)
|
1964
|
-
|
1965
|
-
- scope: `search`
|
1966
|
-
- type: `array of string`
|
1967
|
-
- default: ""
|
1968
|
-
|
1969
|
-
**This parameter is deprecated. You should use [filters](#filters) instead.**
|
1970
|
-
|
1971
|
-
Filter the query by a set of tags.
|
1972
|
-
|
1973
|
-
You can AND tags by separating them with commas.
|
1974
|
-
To OR tags, you must add parentheses.
|
1975
|
-
|
1976
|
-
For example: `["tag1",["tag2","tag3"]]` means `tag1 AND (tag2 OR tag3)`.
|
1977
|
-
|
1978
|
-
Negations are supported via the `-` operator, prefixing the value.
|
1979
|
-
|
1980
|
-
For example: `["tag1", "-tag2"]`.
|
1981
|
-
|
1982
|
-
At indexing, tags should be added in the **_tags** attribute of objects.
|
1983
|
-
|
1984
|
-
For example `{"_tags":["tag1","tag2"]}`.
|
1985
|
-
|
1986
|
-
#### analytics
|
1987
|
-
|
1988
|
-
- scope: `search`
|
1989
|
-
- type: `boolean`
|
1990
|
-
- default: true
|
1991
|
-
|
1992
|
-
If set to false, this query will not be taken into account in the analytics.
|
1993
|
-
|
1994
|
-
#### analyticsTags
|
1995
|
-
|
1996
|
-
- scope: `search`
|
1997
|
-
- type: `array of strings`
|
1998
|
-
|
1999
|
-
If set, tag your query with the specified identifiers. Tags can then be used in the Analytics to analyze a subset of searches only.
|
2000
|
-
|
2001
|
-
#### synonyms
|
2002
|
-
|
2003
|
-
- scope: `search`
|
2004
|
-
- type: `boolean`
|
2005
|
-
- default: true
|
2006
|
-
|
2007
|
-
If set to `false`, the search will not use the synonyms defined for the targeted index.
|
2008
|
-
|
2009
|
-
#### replaceSynonymsInHighlight
|
2010
|
-
|
2011
|
-
- scope: `settings` `search`
|
2012
|
-
- type: `boolean`
|
2013
|
-
- default: true
|
2014
|
-
|
2015
|
-
If set to `false`, words matched via synonyms expansion will not be replaced by the matched synonym in the highlighted result.
|
2232
|
+
- all fields triggered by [getRankingInfo](#getrankinginfo)
|
2016
2233
|
|
2017
2234
|
|
2018
2235
|
# Manage Indices
|
@@ -2033,7 +2250,7 @@ You can list all your indices along with their associated information (number of
|
|
2033
2250
|
Algolia.list_indexes
|
2034
2251
|
```
|
2035
2252
|
|
2036
|
-
## Delete index - `delete_index`
|
2253
|
+
## Delete an index - `delete_index`
|
2037
2254
|
|
2038
2255
|
You can delete an index using its name:
|
2039
2256
|
|
@@ -2042,7 +2259,7 @@ index = Algolia::Index.new("contacts")
|
|
2042
2259
|
index.delete_index
|
2043
2260
|
```
|
2044
2261
|
|
2045
|
-
## Clear index - `clear_index`
|
2262
|
+
## Clear an index - `clear_index`
|
2046
2263
|
|
2047
2264
|
You can delete the index contents without removing settings and index specific API keys by using the `clearIndex` command:
|
2048
2265
|
|
@@ -2072,27 +2289,23 @@ move using the `move_index` method.
|
|
2072
2289
|
puts Algolia.move_index("MyNewIndex", "MyIndex")
|
2073
2290
|
```
|
2074
2291
|
|
2075
|
-
**Note
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
**Warning**
|
2080
|
-
|
2081
|
-
The move_index operation will override all settings of the destination,
|
2082
|
-
There is one exception for the [replicas](#replicas) parameter which is not impacted.
|
2292
|
+
**Note:** The move_index method overrides the destination index, and deletes the temporary one.
|
2293
|
+
In other words, there is no need to call the `clear_index` or `delete_index` methods to clean the temporary index.
|
2294
|
+
It also overrides all the settings of the destination index (except the [replicas](#replicas) parameter that need to not be part of the temporary index settings).
|
2083
2295
|
|
2084
|
-
|
2296
|
+
**Recommended steps**
|
2297
|
+
If you want to fully update your index `MyIndex` every night, we recommend the following process:
|
2085
2298
|
|
2086
2299
|
1. Get settings and synonyms from the old index using [Get settings](#get-settings)
|
2087
2300
|
and [Get synonym](#get-synonym).
|
2088
2301
|
1. Apply settings and synonyms to the temporary index `MyTmpIndex`, (this will create the `MyTmpIndex` index)
|
2089
|
-
using [Set settings](#set-settings) and [Batch synonyms](#batch-synonyms)
|
2090
|
-
|
2091
|
-
1. Import your records into a new index using [Add Objects](#add-objects).
|
2302
|
+
using [Set settings](#set-settings) and [Batch synonyms](#batch-synonyms) ([!] Make sure to remove the [replicas](#replicas) parameter from the settings if it exists.
|
2303
|
+
1. Import your records into a new index using [Add Objects](#add-objects)).
|
2092
2304
|
1. Atomically replace the index `MyIndex` with the content and settings of the index `MyTmpIndex`
|
2093
2305
|
using the [Move index](#move-index) method.
|
2094
2306
|
This will automatically override the old index without any downtime on the search.
|
2095
|
-
|
2307
|
+
|
2308
|
+
You'll end up with only one index called `MyIndex`, that contains the records and settings pushed to `MyTmpIndex`
|
2096
2309
|
and the replica-indices that were initially attached to `MyIndex` will be in sync with the new data.
|
2097
2310
|
|
2098
2311
|
|
@@ -2590,7 +2803,7 @@ Algolia.get_user_key("f420238212c54dcfad07ea0aa6d5c45f")
|
|
2590
2803
|
index.get_user_key("71671c38001bf3ac857bc82052485107")
|
2591
2804
|
```
|
2592
2805
|
|
2593
|
-
## Get
|
2806
|
+
## Get latest logs - `get_logs`
|
2594
2807
|
|
2595
2808
|
You can retrieve the latest logs via this API. Each log entry contains:
|
2596
2809
|
|