@@ -57,18 +57,33 @@ client.search();
57
57
```
58
58
59
59
#### Fetch search suggestions
60
+ Search suggestions are keywords and search phrases that real users have used in your search. Configure Search
61
+ suggestions on AddSearch Dashboard before using this function.
60
62
``` js
61
- // Configure Search suggestions on AddSearch Dashboard first
62
63
// Get suggestions starting with a specific prefix
63
64
client .suggestions (' a' , callback);
64
65
```
65
66
66
- #### Number of search suggestions
67
+ #### Set the number of search suggestions to fetch
67
68
``` js
68
69
// Number of search suggestions to fetch (default 10)
69
70
client .setSuggestionsSize (20 );
70
71
```
71
72
73
+ #### Fetch custom field autocompletion
74
+ Custom fields autocomplete can be used for predictive search. For example, product names or categories can be
75
+ suggested as the keyword is being typed in.
76
+ ``` js
77
+ // Fetch custom field values starting with a specific prefix. In this example, results could be "adidas, apple, azure"
78
+ client .autocomplete (' custom_fields.brand' , ' a' , callback);
79
+ ```
80
+
81
+ #### Set the number of custom field autocompletion results to fetch
82
+ ``` js
83
+ // Number of autocompletion results to fetch (default 10)
84
+ client .setAutocompleteSize (20 );
85
+ ```
86
+
72
87
#### Search with fuzzy matching
73
88
``` js
74
89
// Enable/disable fuzzy matching. Possible values true/false/"auto" (default: "auto")
@@ -163,6 +178,22 @@ client.removeCustomFieldFilter('city','paris');
163
178
client .removeCustomFieldFilter (' city' );
164
179
```
165
180
181
+ #### Set filtering object
182
+ Set complex filtering object that can contain nested * and* , * or* , * not* , and * range* filters.
183
+
184
+ ``` js
185
+ // Find results where brand is apple, color is not white, and price is between 200 and 500
186
+ var filter = {
187
+ ' and' : [
188
+ {' custom_fields.brand' : ' apple' },
189
+ {' not' : {' custom_fields.color' : ' white' }},
190
+ {' range' : {' custom_fields.price' : {' gt' : 200 , ' lt' : 500 }}}
191
+ ]
192
+ };
193
+
194
+ client .setFilterObject (filter);
195
+ ```
196
+
166
197
#### Manage paging
167
198
Set page number, page size and sorting parameters. It's possible to order results by:
168
199
- relevance (descending)
0 commit comments