algoliasearch 5.2.5 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builds/browser.ts +43 -68
- package/builds/models.ts +3 -3
- package/builds/node.ts +39 -122
- package/dist/algoliasearch.umd.js +8 -8
- package/dist/browser.d.ts +10 -100
- package/dist/browser.js +28 -56
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/lite/browser.d.ts +611 -545
- package/dist/lite/builds/browser.js +36 -26
- package/dist/lite/builds/browser.js.map +1 -1
- package/dist/lite/builds/browser.min.js +1 -1
- package/dist/lite/builds/browser.min.js.map +1 -1
- package/dist/lite/builds/browser.umd.js +2 -2
- package/dist/lite/builds/node.cjs +36 -26
- package/dist/lite/builds/node.cjs.map +1 -1
- package/dist/lite/builds/node.js +36 -26
- package/dist/lite/builds/node.js.map +1 -1
- package/dist/lite/node.d.cts +611 -545
- package/dist/lite/node.d.ts +611 -545
- package/dist/lite/src/liteClient.cjs +36 -26
- package/dist/lite/src/liteClient.cjs.map +1 -1
- package/dist/lite/src/liteClient.js +36 -26
- package/dist/lite/src/liteClient.js.map +1 -1
- package/dist/node.cjs +25 -89
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +10 -116
- package/dist/node.d.ts +10 -116
- package/dist/node.js +25 -96
- package/dist/node.js.map +1 -1
- package/lite/builds/browser.ts +3 -7
- package/lite/builds/node.ts +3 -7
- package/lite/src/liteClient.ts +37 -26
- package/package.json +9 -9
package/dist/lite/browser.d.ts
CHANGED
|
@@ -1,52 +1,5 @@
|
|
|
1
1
|
import * as _algolia_client_common from '@algolia/client-common';
|
|
2
|
-
import { ClientOptions } from '@algolia/client-common';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Access control list permissions.
|
|
6
|
-
*/
|
|
7
|
-
type Acl = 'addObject' | 'analytics' | 'browse' | 'deleteIndex' | 'deleteObject' | 'editSettings' | 'inference' | 'listIndexes' | 'logs' | 'personalization' | 'recommendation' | 'search' | 'seeUnretrievableAttributes' | 'settings' | 'usage';
|
|
8
|
-
|
|
9
|
-
type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
|
|
10
|
-
|
|
11
|
-
type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* API key object.
|
|
15
|
-
*/
|
|
16
|
-
type ApiKey = {
|
|
17
|
-
/**
|
|
18
|
-
* Permissions that determine the type of API requests this key can make. The required ACL is listed in each endpoint\'s reference. For more information, see [access control list](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl).
|
|
19
|
-
*/
|
|
20
|
-
acl: Acl[];
|
|
21
|
-
/**
|
|
22
|
-
* Description of an API key to help you identify this API key.
|
|
23
|
-
*/
|
|
24
|
-
description?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Index names or patterns that this API key can access. By default, an API key can access all indices in the same application. You can use leading and trailing wildcard characters (`*`): - `dev_*` matches all indices starting with \"dev_\". - `*_dev` matches all indices ending with \"_dev\". - `*_products_*` matches all indices containing \"_products_\".
|
|
27
|
-
*/
|
|
28
|
-
indexes?: string[];
|
|
29
|
-
/**
|
|
30
|
-
* Maximum number of results this API key can retrieve in one query. By default, there\'s no limit.
|
|
31
|
-
*/
|
|
32
|
-
maxHitsPerQuery?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Maximum number of API requests allowed per IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) per hour. If this limit is reached, the API returns an error with status code `429`. By default, there\'s no limit.
|
|
35
|
-
*/
|
|
36
|
-
maxQueriesPerIPPerHour?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Query parameters to add when making API requests with this API key. To restrict this API key to specific IP addresses, add the `restrictSources` parameter. You can only add a single source, but you can provide a range of IP addresses. Creating an API key fails if the request is made from an IP address that\'s outside the restricted range.
|
|
39
|
-
*/
|
|
40
|
-
queryParameters?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Allowed HTTP referrers for this API key. By default, all referrers are allowed. You can use leading and trailing wildcard characters (`*`): - `https://algolia.com/_*` allows all referrers starting with \"https://algolia.com/\" - `*.algolia.com` allows all referrers ending with \".algolia.com\" - `*algolia.com*` allows all referrers in the domain \"algolia.com\". Like all HTTP headers, referrers can be spoofed. Don\'t rely on them to secure your data. For more information, see [HTTP referrer restrictions](https://www.algolia.com/doc/guides/security/security-best-practices/#http-referrers-restrictions).
|
|
43
|
-
*/
|
|
44
|
-
referers?: string[];
|
|
45
|
-
/**
|
|
46
|
-
* Duration (in seconds) after which the API key expires. By default, API keys don\'t expire.
|
|
47
|
-
*/
|
|
48
|
-
validity?: number;
|
|
49
|
-
};
|
|
2
|
+
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
|
|
50
3
|
|
|
51
4
|
/**
|
|
52
5
|
* Range object with lower and upper values in meters to define custom ranges.
|
|
@@ -77,116 +30,6 @@ type AroundRadiusAll = 'all';
|
|
|
77
30
|
*/
|
|
78
31
|
type AroundRadius = AroundRadiusAll | number;
|
|
79
32
|
|
|
80
|
-
/**
|
|
81
|
-
* Filter or optional filter to be applied to the search.
|
|
82
|
-
*/
|
|
83
|
-
type AutomaticFacetFilter = {
|
|
84
|
-
/**
|
|
85
|
-
* Facet name to be applied as filter. The name must match placeholders in the `pattern` parameter. For example, with `pattern: {facet:genre}`, `automaticFacetFilters` must be `genre`.
|
|
86
|
-
*/
|
|
87
|
-
facet: string;
|
|
88
|
-
/**
|
|
89
|
-
* Filter scores to give different weights to individual filters.
|
|
90
|
-
*/
|
|
91
|
-
score?: number;
|
|
92
|
-
/**
|
|
93
|
-
* Whether the filter is disjunctive or conjunctive. If true the filter has multiple matches, multiple occurences are combined with the logical `OR` operation. If false, multiple occurences are combined with the logical `AND` operation.
|
|
94
|
-
*/
|
|
95
|
-
disjunctive?: boolean;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Filter to be applied to the search. You can use this to respond to search queries that match a facet value. For example, if users search for \"comedy\", which matches a facet value of the \"genre\" facet, you can filter the results to show the top-ranked comedy movies.
|
|
100
|
-
*/
|
|
101
|
-
type AutomaticFacetFilters = AutomaticFacetFilter[] | string[];
|
|
102
|
-
|
|
103
|
-
type BaseGetApiKeyResponse = {
|
|
104
|
-
/**
|
|
105
|
-
* API key.
|
|
106
|
-
*/
|
|
107
|
-
value?: string;
|
|
108
|
-
/**
|
|
109
|
-
* Timestamp when the object was created, in milliseconds since the Unix epoch.
|
|
110
|
-
*/
|
|
111
|
-
createdAt: number;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* ISO code for a supported language.
|
|
116
|
-
*/
|
|
117
|
-
type SupportedLanguage = 'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt-br' | 'pt' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh';
|
|
118
|
-
|
|
119
|
-
type BaseIndexSettings = {
|
|
120
|
-
/**
|
|
121
|
-
* Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows using this attribute as a filter, but doesn\'t evalue the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`.
|
|
122
|
-
*/
|
|
123
|
-
attributesForFaceting?: string[];
|
|
124
|
-
/**
|
|
125
|
-
* Creates [replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/). Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you\'ll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index. **Modifier** - `virtual(\"REPLICA\")`. Create a virtual replica, Virtual replicas don\'t increase the number of records and are optimized for [Relevant sorting](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort/).
|
|
126
|
-
*/
|
|
127
|
-
replicas?: string[];
|
|
128
|
-
/**
|
|
129
|
-
* Maximum number of search results that can be obtained through pagination. Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can\'t be guaranteed.
|
|
130
|
-
*/
|
|
131
|
-
paginationLimitedTo?: number;
|
|
132
|
-
/**
|
|
133
|
-
* Attributes that can\'t be retrieved at query time. This can be useful if you want to use an attribute for ranking or to [restrict access](https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data/), but don\'t want to include it in the search results. Attribute names are case-sensitive.
|
|
134
|
-
*/
|
|
135
|
-
unretrievableAttributes?: string[];
|
|
136
|
-
/**
|
|
137
|
-
* Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). This also turns off [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) for the specified words.
|
|
138
|
-
*/
|
|
139
|
-
disableTypoToleranceOnWords?: string[];
|
|
140
|
-
/**
|
|
141
|
-
* Attributes, for which you want to support [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead). Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive.
|
|
142
|
-
*/
|
|
143
|
-
attributesToTransliterate?: string[];
|
|
144
|
-
/**
|
|
145
|
-
* Attributes for which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. Attribute names are case-sensitive.
|
|
146
|
-
*/
|
|
147
|
-
camelCaseAttributes?: string[];
|
|
148
|
-
/**
|
|
149
|
-
* Searchable attributes to which Algolia should apply [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding). Attribute names are case-sensitive. Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, \"firefighter\". With decompounding, the individual components are indexed separately. You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (`nl`), German (`de`), Finnish (`fi`), Danish (`da`), Swedish (`sv`), and Norwegian (`no`). Decompounding doesn\'t work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won\'t be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308).
|
|
150
|
-
*/
|
|
151
|
-
decompoundedAttributes?: Record<string, unknown>;
|
|
152
|
-
/**
|
|
153
|
-
* Languages for language-specific processing steps, such as word detection and dictionary settings. **You should always specify an indexing language.** If you don\'t specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).
|
|
154
|
-
*/
|
|
155
|
-
indexLanguages?: SupportedLanguage[];
|
|
156
|
-
/**
|
|
157
|
-
* Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). Attribute names are case-sensitive.
|
|
158
|
-
*/
|
|
159
|
-
disablePrefixOnAttributes?: string[];
|
|
160
|
-
/**
|
|
161
|
-
* Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.
|
|
162
|
-
*/
|
|
163
|
-
allowCompressionOfIntegerArray?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). Attribute names are case-sensitive. By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes. If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn\'t exist in your index, such as `NO_NUMERIC_FILTERING`. **Modifier** - `equalOnly(\"ATTRIBUTE\")`. Support only filtering based on equality comparisons `=` and `!=`.
|
|
166
|
-
*/
|
|
167
|
-
numericAttributesForFiltering?: string[];
|
|
168
|
-
/**
|
|
169
|
-
* Controls which separators are indexed. Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren\'t indexed. With `separatorsToIndex`, Algolia treats separator characters as separate words. For example, a search for `C#` would report two matches.
|
|
170
|
-
*/
|
|
171
|
-
separatorsToIndex?: string;
|
|
172
|
-
/**
|
|
173
|
-
* Attributes used for searching. Attribute names are case-sensitive. By default, all attributes are searchable and the [Attribute](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute) ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of `searchableAttributes` rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as `\"title,alternate_title\"`. Attributes with the same priority are always unordered. For more information, see [Searchable attributes](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/setting-searchable-attributes/). **Modifier** - `unordered(\"ATTRIBUTE\")`. Ignore the position of a match within the attribute. Without modifier, matches at the beginning of an attribute rank higer than matches at the end.
|
|
174
|
-
*/
|
|
175
|
-
searchableAttributes?: string[];
|
|
176
|
-
/**
|
|
177
|
-
* An object with custom data. You can store up to 32kB as custom data.
|
|
178
|
-
*/
|
|
179
|
-
userData?: Record<string, unknown>;
|
|
180
|
-
/**
|
|
181
|
-
* Characters and their normalized replacements. This overrides Algolia\'s default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).
|
|
182
|
-
*/
|
|
183
|
-
customNormalization?: Record<string, Record<string, string>>;
|
|
184
|
-
/**
|
|
185
|
-
* Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts.
|
|
186
|
-
*/
|
|
187
|
-
attributeForDistinct?: string;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
33
|
/**
|
|
191
34
|
* Filter the search by facet values, so that only records with the same facet values are retrieved. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** - `[filter1, filter2]` is interpreted as `filter1 AND filter2`. - `[[filter1, filter2], filter3]` is interpreted as `filter1 OR filter2 AND filter3`. - `facet:-value` is interpreted as `NOT facet:value`. While it\'s best to avoid attributes that start with a `-`, you can still filter them by escaping with a backslash: `facet:\\-value`.
|
|
192
35
|
*/
|
|
@@ -202,6 +45,11 @@ type NumericFilters = NumericFilters[] | string;
|
|
|
202
45
|
*/
|
|
203
46
|
type OptionalFilters = OptionalFilters[] | string;
|
|
204
47
|
|
|
48
|
+
/**
|
|
49
|
+
* ISO code for a supported language.
|
|
50
|
+
*/
|
|
51
|
+
type SupportedLanguage = 'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt-br' | 'pt' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh';
|
|
52
|
+
|
|
205
53
|
/**
|
|
206
54
|
* Filter the search by values of the special `_tags` attribute. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** Different from regular facets, `_tags` can only be used for filtering (including or excluding records). You won\'t get a facet count. The same combination and escaping rules apply as for `facetFilters`.
|
|
207
55
|
*/
|
|
@@ -325,6 +173,10 @@ type SearchParamsQuery = {
|
|
|
325
173
|
|
|
326
174
|
type BaseSearchParams = BaseSearchParamsWithoutQuery & SearchParamsQuery;
|
|
327
175
|
|
|
176
|
+
type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
|
|
177
|
+
|
|
178
|
+
type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
|
|
179
|
+
|
|
328
180
|
/**
|
|
329
181
|
* Determines how many records of a group are included in the search results. Records with the same value for the `attributeForDistinct` attribute are considered a group. The `distinct` setting controls how many members of the group are returned. This is useful for [deduplication and grouping](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). The `distinct` setting is ignored if `attributeForDistinct` is not set.
|
|
330
182
|
*/
|
|
@@ -610,88 +462,290 @@ type BaseRecommendRequest = {
|
|
|
610
462
|
};
|
|
611
463
|
|
|
612
464
|
/**
|
|
613
|
-
*
|
|
465
|
+
* Frequently bought together model. This model recommends items that have been purchased within 1 day with the item with the ID `objectID`.
|
|
614
466
|
*/
|
|
615
|
-
type
|
|
616
|
-
/**
|
|
617
|
-
* Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
|
|
618
|
-
*/
|
|
619
|
-
facetsCount?: boolean;
|
|
620
|
-
/**
|
|
621
|
-
* The value is `false` if not all facet values are retrieved.
|
|
622
|
-
*/
|
|
623
|
-
facetValues?: boolean;
|
|
624
|
-
/**
|
|
625
|
-
* Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.
|
|
626
|
-
*/
|
|
627
|
-
nbHits?: boolean;
|
|
628
|
-
/**
|
|
629
|
-
* Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.
|
|
630
|
-
*/
|
|
631
|
-
rulesMatch?: boolean;
|
|
632
|
-
/**
|
|
633
|
-
* Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.
|
|
634
|
-
*/
|
|
635
|
-
typo?: boolean;
|
|
636
|
-
};
|
|
467
|
+
type FbtModel = 'bought-together';
|
|
637
468
|
|
|
638
|
-
type
|
|
639
|
-
|
|
640
|
-
* Minimum value in the results.
|
|
641
|
-
*/
|
|
642
|
-
min?: number;
|
|
643
|
-
/**
|
|
644
|
-
* Maximum value in the results.
|
|
645
|
-
*/
|
|
646
|
-
max?: number;
|
|
647
|
-
/**
|
|
648
|
-
* Average facet value in the results.
|
|
649
|
-
*/
|
|
650
|
-
avg?: number;
|
|
469
|
+
type FrequentlyBoughtTogether = {
|
|
470
|
+
model: FbtModel;
|
|
651
471
|
/**
|
|
652
|
-
*
|
|
472
|
+
* Unique record identifier.
|
|
653
473
|
*/
|
|
654
|
-
|
|
474
|
+
objectID: string;
|
|
655
475
|
};
|
|
656
476
|
|
|
477
|
+
type BoughtTogetherQuery = BaseRecommendRequest & FrequentlyBoughtTogether;
|
|
478
|
+
|
|
479
|
+
type FallbackParams = Record<string, unknown> & SearchParamsObject;
|
|
480
|
+
|
|
657
481
|
/**
|
|
658
|
-
*
|
|
482
|
+
* Looking similar model. This model recommends items that look similar to the item with the ID `objectID` based on image attributes in your index.
|
|
659
483
|
*/
|
|
660
|
-
type
|
|
661
|
-
ruleObjectID: string;
|
|
662
|
-
};
|
|
484
|
+
type LookingSimilarModel = 'looking-similar';
|
|
663
485
|
|
|
664
|
-
type
|
|
665
|
-
|
|
666
|
-
* Source index for the redirect rule.
|
|
667
|
-
*/
|
|
668
|
-
source: string;
|
|
669
|
-
/**
|
|
670
|
-
* Destination index for the redirect rule.
|
|
671
|
-
*/
|
|
672
|
-
dest: string;
|
|
673
|
-
/**
|
|
674
|
-
* Reason for the redirect rule.
|
|
675
|
-
*/
|
|
676
|
-
reason: string;
|
|
486
|
+
type LookingSimilar = {
|
|
487
|
+
model: LookingSimilarModel;
|
|
677
488
|
/**
|
|
678
|
-
*
|
|
489
|
+
* Unique record identifier.
|
|
679
490
|
*/
|
|
680
|
-
|
|
681
|
-
|
|
491
|
+
objectID: string;
|
|
492
|
+
fallbackParameters?: FallbackParams;
|
|
682
493
|
};
|
|
683
494
|
|
|
495
|
+
type LookingSimilarQuery = BaseRecommendRequest & LookingSimilar;
|
|
496
|
+
|
|
684
497
|
/**
|
|
685
|
-
*
|
|
498
|
+
* \"Recommened for you\" model.
|
|
686
499
|
*/
|
|
687
|
-
type
|
|
688
|
-
|
|
500
|
+
type RecommendedForYouModel = 'recommended-for-you';
|
|
501
|
+
|
|
502
|
+
type RecommendedForYou = {
|
|
503
|
+
model: RecommendedForYouModel;
|
|
504
|
+
fallbackParameters?: FallbackParams;
|
|
689
505
|
};
|
|
690
506
|
|
|
691
|
-
type
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
507
|
+
type RecommendedForYouQuery = BaseRecommendRequest & RecommendedForYou;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Related products or similar content model. This model recommends items that are similar to the item with the ID `objectID`. Similarity is determined from the user interactions and attributes.
|
|
511
|
+
*/
|
|
512
|
+
type RelatedModel = 'related-products';
|
|
513
|
+
|
|
514
|
+
type RelatedProducts = {
|
|
515
|
+
model: RelatedModel;
|
|
516
|
+
/**
|
|
517
|
+
* Unique record identifier.
|
|
518
|
+
*/
|
|
519
|
+
objectID: string;
|
|
520
|
+
fallbackParameters?: FallbackParams;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
type RelatedQuery = BaseRecommendRequest & RelatedProducts;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Trending facet values model. This model recommends trending facet values for the specified facet attribute.
|
|
527
|
+
*/
|
|
528
|
+
type TrendingFacetsModel = 'trending-facets';
|
|
529
|
+
|
|
530
|
+
type TrendingFacets = {
|
|
531
|
+
/**
|
|
532
|
+
* Facet attribute for which to retrieve trending facet values.
|
|
533
|
+
*/
|
|
534
|
+
facetName: any | null;
|
|
535
|
+
model: TrendingFacetsModel;
|
|
536
|
+
fallbackParameters?: FallbackParams;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
type TrendingFacetsQuery = BaseRecommendRequest & TrendingFacets;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Trending items model. Trending items are determined from the number of conversion events collected on them.
|
|
543
|
+
*/
|
|
544
|
+
type TrendingItemsModel = 'trending-items';
|
|
545
|
+
|
|
546
|
+
type TrendingItems = {
|
|
547
|
+
/**
|
|
548
|
+
* Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
|
|
549
|
+
*/
|
|
550
|
+
facetName?: string;
|
|
551
|
+
/**
|
|
552
|
+
* Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
|
|
553
|
+
*/
|
|
554
|
+
facetValue?: string;
|
|
555
|
+
model: TrendingItemsModel;
|
|
556
|
+
fallbackParameters?: SearchParamsObject;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
type TrendingItemsQuery = BaseRecommendRequest & TrendingItems;
|
|
560
|
+
|
|
561
|
+
type RecommendationsRequest = BoughtTogetherQuery | LookingSimilarQuery | RecommendedForYouQuery | RelatedQuery | TrendingFacetsQuery | TrendingItemsQuery;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
|
|
565
|
+
*/
|
|
566
|
+
type SearchTypeFacet = 'facet';
|
|
567
|
+
|
|
568
|
+
type SearchForFacetsOptions = {
|
|
569
|
+
/**
|
|
570
|
+
* Facet name.
|
|
571
|
+
*/
|
|
572
|
+
facet: string;
|
|
573
|
+
/**
|
|
574
|
+
* Index name (case-sensitive).
|
|
575
|
+
*/
|
|
576
|
+
indexName: string;
|
|
577
|
+
/**
|
|
578
|
+
* Text to search inside the facet\'s values.
|
|
579
|
+
*/
|
|
580
|
+
facetQuery?: string;
|
|
581
|
+
/**
|
|
582
|
+
* Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
|
|
583
|
+
*/
|
|
584
|
+
maxFacetHits?: number;
|
|
585
|
+
type: SearchTypeFacet;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
|
|
590
|
+
*/
|
|
591
|
+
type SearchTypeDefault = 'default';
|
|
592
|
+
|
|
593
|
+
type SearchForHitsOptions = {
|
|
594
|
+
/**
|
|
595
|
+
* Index name (case-sensitive).
|
|
596
|
+
*/
|
|
597
|
+
indexName: string;
|
|
598
|
+
type?: SearchTypeDefault;
|
|
599
|
+
} & {
|
|
600
|
+
facet?: never;
|
|
601
|
+
maxFacetHits?: never;
|
|
602
|
+
facetQuery?: never;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Properties for the `customPost` method.
|
|
607
|
+
*/
|
|
608
|
+
type CustomPostProps = {
|
|
609
|
+
/**
|
|
610
|
+
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
611
|
+
*/
|
|
612
|
+
path: string;
|
|
613
|
+
/**
|
|
614
|
+
* Query parameters to apply to the current query.
|
|
615
|
+
*/
|
|
616
|
+
parameters?: Record<string, any>;
|
|
617
|
+
/**
|
|
618
|
+
* Parameters to send with the custom request.
|
|
619
|
+
*/
|
|
620
|
+
body?: Record<string, unknown>;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* Recommend method signature compatible with the `algoliasearch` v4 package. When using this signature, extra computation will be required to make it match the new signature.
|
|
624
|
+
*
|
|
625
|
+
* @deprecated This signature will be removed from the next major version, we recommend using the `GetRecommendationsParams` type for performances and future proof reasons.
|
|
626
|
+
*/
|
|
627
|
+
type LegacyGetRecommendationsParams = RecommendationsRequest[];
|
|
628
|
+
/**
|
|
629
|
+
* In v4, the search parameters are wrapped in a `params` parameter.
|
|
630
|
+
*
|
|
631
|
+
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
632
|
+
*/
|
|
633
|
+
type LegacySearchParams = {
|
|
634
|
+
params?: SearchParamsObject;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* In v4, the search parameters are wrapped in a `params` parameter.
|
|
638
|
+
*
|
|
639
|
+
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
640
|
+
*/
|
|
641
|
+
type LegacySearchForFacets = LegacySearchParams & SearchForFacetsOptions;
|
|
642
|
+
/**
|
|
643
|
+
* In v4, the search parameters are wrapped in a `params` parameter.
|
|
644
|
+
*
|
|
645
|
+
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
646
|
+
*/
|
|
647
|
+
type LegacySearchForHits = LegacySearchParams & SearchForHitsOptions;
|
|
648
|
+
type LegacySearchQuery = LegacySearchForFacets | LegacySearchForHits;
|
|
649
|
+
/**
|
|
650
|
+
* Search method signature compatible with the `algoliasearch` v4 package. When using this signature, extra computation will be required to make it match the new signature.
|
|
651
|
+
*
|
|
652
|
+
* @deprecated This signature will be removed from the next major version, we recommend using the `SearchMethodParams` type for performances and future proof reasons.
|
|
653
|
+
*/
|
|
654
|
+
type LegacySearchMethodProps = LegacySearchQuery[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Recommend request body.
|
|
658
|
+
*/
|
|
659
|
+
type GetRecommendationsParams = {
|
|
660
|
+
/**
|
|
661
|
+
* Recommendation request with parameters depending on the requested model.
|
|
662
|
+
*/
|
|
663
|
+
requests: RecommendationsRequest[];
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Whether certain properties of the search response are calculated exhaustive (exact) or approximated.
|
|
668
|
+
*/
|
|
669
|
+
type Exhaustive = {
|
|
670
|
+
/**
|
|
671
|
+
* Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
|
|
672
|
+
*/
|
|
673
|
+
facetsCount?: boolean;
|
|
674
|
+
/**
|
|
675
|
+
* The value is `false` if not all facet values are retrieved.
|
|
676
|
+
*/
|
|
677
|
+
facetValues?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.
|
|
680
|
+
*/
|
|
681
|
+
nbHits?: boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.
|
|
684
|
+
*/
|
|
685
|
+
rulesMatch?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.
|
|
688
|
+
*/
|
|
689
|
+
typo?: boolean;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
type FacetStats = {
|
|
693
|
+
/**
|
|
694
|
+
* Minimum value in the results.
|
|
695
|
+
*/
|
|
696
|
+
min?: number;
|
|
697
|
+
/**
|
|
698
|
+
* Maximum value in the results.
|
|
699
|
+
*/
|
|
700
|
+
max?: number;
|
|
701
|
+
/**
|
|
702
|
+
* Average facet value in the results.
|
|
703
|
+
*/
|
|
704
|
+
avg?: number;
|
|
705
|
+
/**
|
|
706
|
+
* Sum of all values in the results.
|
|
707
|
+
*/
|
|
708
|
+
sum?: number;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Redirect rule data.
|
|
713
|
+
*/
|
|
714
|
+
type RedirectRuleIndexData = {
|
|
715
|
+
ruleObjectID: string;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
type RedirectRuleIndexMetadata = {
|
|
719
|
+
/**
|
|
720
|
+
* Source index for the redirect rule.
|
|
721
|
+
*/
|
|
722
|
+
source: string;
|
|
723
|
+
/**
|
|
724
|
+
* Destination index for the redirect rule.
|
|
725
|
+
*/
|
|
726
|
+
dest: string;
|
|
727
|
+
/**
|
|
728
|
+
* Reason for the redirect rule.
|
|
729
|
+
*/
|
|
730
|
+
reason: string;
|
|
731
|
+
/**
|
|
732
|
+
* Redirect rule status.
|
|
733
|
+
*/
|
|
734
|
+
succeed: boolean;
|
|
735
|
+
data: RedirectRuleIndexData;
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
|
|
740
|
+
*/
|
|
741
|
+
type Redirect = {
|
|
742
|
+
index?: RedirectRuleIndexMetadata[];
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
type BaseSearchResponse = Record<string, any> & {
|
|
746
|
+
/**
|
|
747
|
+
* A/B test ID. This is only included in the response for indices that are part of an A/B test.
|
|
748
|
+
*/
|
|
695
749
|
abTestID?: number;
|
|
696
750
|
/**
|
|
697
751
|
* Variant ID. This is only included in the response for indices that are part of an A/B test.
|
|
@@ -779,59 +833,16 @@ type BaseSearchResponse = Record<string, any> & {
|
|
|
779
833
|
};
|
|
780
834
|
|
|
781
835
|
/**
|
|
782
|
-
*
|
|
836
|
+
* Whether the whole query string matches or only a part.
|
|
783
837
|
*/
|
|
784
|
-
type
|
|
838
|
+
type MatchLevel = 'full' | 'none' | 'partial';
|
|
785
839
|
|
|
786
|
-
|
|
787
|
-
|
|
840
|
+
/**
|
|
841
|
+
* Surround words that match the query with HTML tags for highlighting.
|
|
842
|
+
*/
|
|
843
|
+
type HighlightResultOption = {
|
|
788
844
|
/**
|
|
789
|
-
*
|
|
790
|
-
*/
|
|
791
|
-
objectID: string;
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
type BoughtTogetherQuery = BaseRecommendRequest & FrequentlyBoughtTogether;
|
|
795
|
-
|
|
796
|
-
type BrowsePagination = {
|
|
797
|
-
/**
|
|
798
|
-
* Page of search results to retrieve.
|
|
799
|
-
*/
|
|
800
|
-
page?: number;
|
|
801
|
-
/**
|
|
802
|
-
* Number of results (hits).
|
|
803
|
-
*/
|
|
804
|
-
nbHits?: number;
|
|
805
|
-
/**
|
|
806
|
-
* Number of pages of results.
|
|
807
|
-
*/
|
|
808
|
-
nbPages?: number;
|
|
809
|
-
/**
|
|
810
|
-
* Number of hits per page.
|
|
811
|
-
*/
|
|
812
|
-
hitsPerPage?: number;
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
type Cursor = {
|
|
816
|
-
/**
|
|
817
|
-
* Cursor to get the next page of the response. The parameter must match the value returned in the response of a previous request. The last page of the response does not return a `cursor` attribute.
|
|
818
|
-
*/
|
|
819
|
-
cursor?: string;
|
|
820
|
-
};
|
|
821
|
-
|
|
822
|
-
type BrowseParamsObject = Cursor & SearchParamsObject;
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Whether the whole query string matches or only a part.
|
|
826
|
-
*/
|
|
827
|
-
type MatchLevel = 'full' | 'none' | 'partial';
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Surround words that match the query with HTML tags for highlighting.
|
|
831
|
-
*/
|
|
832
|
-
type HighlightResultOption = {
|
|
833
|
-
/**
|
|
834
|
-
* Highlighted attribute value, including HTML tags.
|
|
845
|
+
* Highlighted attribute value, including HTML tags.
|
|
835
846
|
*/
|
|
836
847
|
value: string;
|
|
837
848
|
matchLevel: MatchLevel;
|
|
@@ -947,9 +958,9 @@ type SnippetResult = Record<string, SnippetResultOption> | SnippetResultOption |
|
|
|
947
958
|
};
|
|
948
959
|
|
|
949
960
|
/**
|
|
950
|
-
*
|
|
961
|
+
* Recommend hit.
|
|
951
962
|
*/
|
|
952
|
-
type
|
|
963
|
+
type RecommendHit = Record<string, any> & {
|
|
953
964
|
/**
|
|
954
965
|
* Unique record identifier.
|
|
955
966
|
*/
|
|
@@ -964,75 +975,59 @@ type Hit<T = Record<string, any>> = T & {
|
|
|
964
975
|
_snippetResult?: Record<string, SnippetResult>;
|
|
965
976
|
_rankingInfo?: RankingInfo;
|
|
966
977
|
_distinctSeqID?: number;
|
|
978
|
+
/**
|
|
979
|
+
* Recommendation score.
|
|
980
|
+
*/
|
|
981
|
+
_score: number;
|
|
967
982
|
};
|
|
968
983
|
|
|
969
|
-
|
|
984
|
+
/**
|
|
985
|
+
* Trending facet hit.
|
|
986
|
+
*/
|
|
987
|
+
type TrendingFacetHit = {
|
|
970
988
|
/**
|
|
971
|
-
*
|
|
989
|
+
* Recommendation score.
|
|
972
990
|
*/
|
|
973
|
-
|
|
991
|
+
_score: number;
|
|
974
992
|
/**
|
|
975
|
-
*
|
|
993
|
+
* Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
|
|
976
994
|
*/
|
|
977
|
-
|
|
995
|
+
facetName: string;
|
|
978
996
|
/**
|
|
979
|
-
*
|
|
997
|
+
* Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
|
|
980
998
|
*/
|
|
981
|
-
|
|
999
|
+
facetValue: string;
|
|
982
1000
|
};
|
|
983
1001
|
|
|
984
|
-
type
|
|
1002
|
+
type RecommendationsHit = RecommendHit | TrendingFacetHit;
|
|
985
1003
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
type EditType = 'remove' | 'replace';
|
|
1004
|
+
type RecommendationsHits = {
|
|
1005
|
+
hits: RecommendationsHit[];
|
|
1006
|
+
};
|
|
990
1007
|
|
|
991
|
-
type
|
|
992
|
-
type?: EditType;
|
|
1008
|
+
type SearchPagination = {
|
|
993
1009
|
/**
|
|
994
|
-
*
|
|
1010
|
+
* Page of search results to retrieve.
|
|
995
1011
|
*/
|
|
996
|
-
|
|
1012
|
+
page: number;
|
|
997
1013
|
/**
|
|
998
|
-
*
|
|
1014
|
+
* Number of results (hits).
|
|
999
1015
|
*/
|
|
1000
|
-
|
|
1001
|
-
};
|
|
1002
|
-
|
|
1003
|
-
type ConsequenceQueryObject = {
|
|
1016
|
+
nbHits: number;
|
|
1004
1017
|
/**
|
|
1005
|
-
*
|
|
1018
|
+
* Number of pages of results.
|
|
1006
1019
|
*/
|
|
1007
|
-
|
|
1020
|
+
nbPages: number;
|
|
1008
1021
|
/**
|
|
1009
|
-
*
|
|
1022
|
+
* Number of hits per page.
|
|
1010
1023
|
*/
|
|
1011
|
-
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* Replace or edit the search query. If `consequenceQuery` is a string, the entire search query is replaced with that string. If `consequenceQuery` is an object, it describes incremental edits made to the query.
|
|
1016
|
-
*/
|
|
1017
|
-
type ConsequenceQuery = ConsequenceQueryObject | string;
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
* Parameters to apply to this search. You can use all search parameters, plus special `automaticFacetFilters`, `automaticOptionalFacetFilters`, and `query`.
|
|
1021
|
-
*/
|
|
1022
|
-
type Params = {
|
|
1023
|
-
query?: ConsequenceQuery;
|
|
1024
|
-
automaticFacetFilters?: AutomaticFacetFilters;
|
|
1025
|
-
automaticOptionalFacetFilters?: AutomaticFacetFilters;
|
|
1026
|
-
renderingContent?: RenderingContent;
|
|
1024
|
+
hitsPerPage: number;
|
|
1027
1025
|
};
|
|
1028
1026
|
|
|
1029
|
-
type
|
|
1027
|
+
type RecommendationsResults = BaseSearchResponse & RecommendationsHits & SearchPagination;
|
|
1030
1028
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
*/
|
|
1034
|
-
type ErrorBase = Record<string, any> & {
|
|
1035
|
-
message?: string;
|
|
1029
|
+
type GetRecommendationsResponse = {
|
|
1030
|
+
results: RecommendationsResults[];
|
|
1036
1031
|
};
|
|
1037
1032
|
|
|
1038
1033
|
type FacetHits = {
|
|
@@ -1050,106 +1045,41 @@ type FacetHits = {
|
|
|
1050
1045
|
count: number;
|
|
1051
1046
|
};
|
|
1052
1047
|
|
|
1053
|
-
type
|
|
1054
|
-
|
|
1055
|
-
type GetApiKeyResponse = ApiKey & BaseGetApiKeyResponse;
|
|
1056
|
-
|
|
1057
|
-
/**
|
|
1058
|
-
* Looking similar model. This model recommends items that look similar to the item with the ID `objectID` based on image attributes in your index.
|
|
1059
|
-
*/
|
|
1060
|
-
type LookingSimilarModel = 'looking-similar';
|
|
1061
|
-
|
|
1062
|
-
type LookingSimilar = {
|
|
1063
|
-
model: LookingSimilarModel;
|
|
1048
|
+
type SearchForFacetValuesResponse = {
|
|
1064
1049
|
/**
|
|
1065
|
-
*
|
|
1050
|
+
* Matching facet values.
|
|
1066
1051
|
*/
|
|
1067
|
-
|
|
1068
|
-
fallbackParameters?: FallbackParams;
|
|
1069
|
-
};
|
|
1070
|
-
|
|
1071
|
-
type LookingSimilarQuery = BaseRecommendRequest & LookingSimilar;
|
|
1072
|
-
|
|
1073
|
-
/**
|
|
1074
|
-
* \"Recommened for you\" model.
|
|
1075
|
-
*/
|
|
1076
|
-
type RecommendedForYouModel = 'recommended-for-you';
|
|
1077
|
-
|
|
1078
|
-
type RecommendedForYou = {
|
|
1079
|
-
model: RecommendedForYouModel;
|
|
1080
|
-
fallbackParameters?: FallbackParams;
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
type RecommendedForYouQuery = BaseRecommendRequest & RecommendedForYou;
|
|
1084
|
-
|
|
1085
|
-
/**
|
|
1086
|
-
* Related products or similar content model. This model recommends items that are similar to the item with the ID `objectID`. Similarity is determined from the user interactions and attributes.
|
|
1087
|
-
*/
|
|
1088
|
-
type RelatedModel = 'related-products';
|
|
1089
|
-
|
|
1090
|
-
type RelatedProducts = {
|
|
1091
|
-
model: RelatedModel;
|
|
1052
|
+
facetHits: FacetHits[];
|
|
1092
1053
|
/**
|
|
1093
|
-
*
|
|
1054
|
+
* Whether the facet count is exhaustive (true) or approximate (false). For more information, see [Why are my facet and hit counts not accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
|
|
1094
1055
|
*/
|
|
1095
|
-
|
|
1096
|
-
fallbackParameters?: FallbackParams;
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
type RelatedQuery = BaseRecommendRequest & RelatedProducts;
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Trending facet values model. This model recommends trending facet values for the specified facet attribute.
|
|
1103
|
-
*/
|
|
1104
|
-
type TrendingFacetsModel = 'trending-facets';
|
|
1105
|
-
|
|
1106
|
-
type TrendingFacets = {
|
|
1056
|
+
exhaustiveFacetsCount: boolean;
|
|
1107
1057
|
/**
|
|
1108
|
-
*
|
|
1058
|
+
* Time the server took to process the request, in milliseconds.
|
|
1109
1059
|
*/
|
|
1110
|
-
|
|
1111
|
-
model: TrendingFacetsModel;
|
|
1112
|
-
fallbackParameters?: FallbackParams;
|
|
1060
|
+
processingTimeMS?: number;
|
|
1113
1061
|
};
|
|
1114
1062
|
|
|
1115
|
-
type
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* Trending items model. Trending items are determined from the number of conversion events collected on them.
|
|
1119
|
-
*/
|
|
1120
|
-
type TrendingItemsModel = 'trending-items';
|
|
1121
|
-
|
|
1122
|
-
type TrendingItems = {
|
|
1123
|
-
/**
|
|
1124
|
-
* Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
|
|
1125
|
-
*/
|
|
1126
|
-
facetName?: string;
|
|
1127
|
-
/**
|
|
1128
|
-
* Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
|
|
1129
|
-
*/
|
|
1130
|
-
facetValue?: string;
|
|
1131
|
-
model: TrendingItemsModel;
|
|
1132
|
-
fallbackParameters?: SearchParamsObject;
|
|
1133
|
-
};
|
|
1063
|
+
type SearchForFacets = SearchForFacetsOptions & SearchParams;
|
|
1134
1064
|
|
|
1135
|
-
type
|
|
1065
|
+
type SearchForHits = SearchForHitsOptions & SearchParams;
|
|
1136
1066
|
|
|
1137
|
-
type
|
|
1067
|
+
type SearchQuery = SearchForFacets | SearchForHits;
|
|
1138
1068
|
|
|
1139
1069
|
/**
|
|
1140
|
-
*
|
|
1070
|
+
* Strategy for multiple search queries: - `none`. Run all queries. - `stopIfEnoughMatches`. Run the queries one by one, stopping as soon as a query matches at least the `hitsPerPage` number of results.
|
|
1141
1071
|
*/
|
|
1142
|
-
type
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1072
|
+
type SearchStrategy = 'none' | 'stopIfEnoughMatches';
|
|
1073
|
+
|
|
1074
|
+
type SearchMethodParams = {
|
|
1075
|
+
requests: SearchQuery[];
|
|
1076
|
+
strategy?: SearchStrategy;
|
|
1147
1077
|
};
|
|
1148
1078
|
|
|
1149
1079
|
/**
|
|
1150
|
-
*
|
|
1080
|
+
* Search result. A hit is a record from your index, augmented with special attributes for highlighting, snippeting, and ranking.
|
|
1151
1081
|
*/
|
|
1152
|
-
type
|
|
1082
|
+
type Hit<T = Record<string, any>> = T & {
|
|
1153
1083
|
/**
|
|
1154
1084
|
* Unique record identifier.
|
|
1155
1085
|
*/
|
|
@@ -1164,228 +1094,364 @@ type RecommendHit = Record<string, any> & {
|
|
|
1164
1094
|
_snippetResult?: Record<string, SnippetResult>;
|
|
1165
1095
|
_rankingInfo?: RankingInfo;
|
|
1166
1096
|
_distinctSeqID?: number;
|
|
1167
|
-
/**
|
|
1168
|
-
* Recommendation score.
|
|
1169
|
-
*/
|
|
1170
|
-
_score: number;
|
|
1171
1097
|
};
|
|
1172
1098
|
|
|
1173
|
-
|
|
1174
|
-
* Trending facet hit.
|
|
1175
|
-
*/
|
|
1176
|
-
type TrendingFacetHit = {
|
|
1099
|
+
type SearchHits<T = Record<string, any>> = Record<string, any> & {
|
|
1177
1100
|
/**
|
|
1178
|
-
*
|
|
1101
|
+
* Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
|
|
1179
1102
|
*/
|
|
1180
|
-
|
|
1103
|
+
hits: Array<Hit<T>>;
|
|
1181
1104
|
/**
|
|
1182
|
-
*
|
|
1105
|
+
* Search query.
|
|
1183
1106
|
*/
|
|
1184
|
-
|
|
1107
|
+
query: string;
|
|
1185
1108
|
/**
|
|
1186
|
-
*
|
|
1109
|
+
* URL-encoded string of all search parameters.
|
|
1187
1110
|
*/
|
|
1188
|
-
|
|
1111
|
+
params: string;
|
|
1189
1112
|
};
|
|
1190
1113
|
|
|
1191
|
-
type
|
|
1114
|
+
type SearchResponse<T = Record<string, any>> = BaseSearchResponse & SearchHits<T> & SearchPagination;
|
|
1192
1115
|
|
|
1193
|
-
type
|
|
1194
|
-
|
|
1116
|
+
type SearchResult<T = Record<string, any>> = SearchForFacetValuesResponse | SearchResponse<T>;
|
|
1117
|
+
|
|
1118
|
+
type SearchResponses<T = Record<string, any>> = {
|
|
1119
|
+
results: Array<SearchResult<T>>;
|
|
1195
1120
|
};
|
|
1196
1121
|
|
|
1197
|
-
|
|
1122
|
+
declare const apiClientVersion = "5.3.0";
|
|
1123
|
+
declare function createLiteClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
1124
|
+
transporter: _algolia_client_common.Transporter;
|
|
1198
1125
|
/**
|
|
1199
|
-
*
|
|
1126
|
+
* The `appId` currently in use.
|
|
1200
1127
|
*/
|
|
1201
|
-
|
|
1128
|
+
appId: string;
|
|
1202
1129
|
/**
|
|
1203
|
-
*
|
|
1130
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
1204
1131
|
*/
|
|
1205
|
-
|
|
1132
|
+
clearCache(): Promise<void>;
|
|
1206
1133
|
/**
|
|
1207
|
-
*
|
|
1134
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
1208
1135
|
*/
|
|
1209
|
-
|
|
1136
|
+
readonly _ua: string;
|
|
1210
1137
|
/**
|
|
1211
|
-
*
|
|
1138
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
1139
|
+
*
|
|
1140
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
1141
|
+
* @param version - The version of the agent.
|
|
1212
1142
|
*/
|
|
1213
|
-
|
|
1214
|
-
};
|
|
1215
|
-
|
|
1216
|
-
type RecommendationsResults = BaseSearchResponse & RecommendationsHits & SearchPagination;
|
|
1217
|
-
|
|
1218
|
-
type GetRecommendationsResponse = {
|
|
1219
|
-
results: RecommendationsResults[];
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
|
-
/**
|
|
1223
|
-
* Index settings.
|
|
1224
|
-
*/
|
|
1225
|
-
type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams;
|
|
1226
|
-
|
|
1227
|
-
type SearchForFacetValuesResponse = {
|
|
1143
|
+
addAlgoliaAgent(segment: string, version?: string): void;
|
|
1228
1144
|
/**
|
|
1229
|
-
*
|
|
1145
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
1146
|
+
*
|
|
1147
|
+
* @param params - Method params.
|
|
1148
|
+
* @param params.apiKey - The new API Key to use.
|
|
1230
1149
|
*/
|
|
1231
|
-
|
|
1150
|
+
setClientApiKey({ apiKey }: {
|
|
1151
|
+
apiKey: string;
|
|
1152
|
+
}): void;
|
|
1232
1153
|
/**
|
|
1233
|
-
*
|
|
1154
|
+
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
|
1155
|
+
* Disclaimer: We don't assert that the parameters you pass to this method only contains `hits` requests to prevent impacting search performances, this helper is purely for typing purposes.
|
|
1156
|
+
*
|
|
1157
|
+
* @summary Search multiple indices for `hits`.
|
|
1158
|
+
* @param searchMethodParams - Query requests and strategies. Results will be received in the same order as the queries.
|
|
1159
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1234
1160
|
*/
|
|
1235
|
-
|
|
1161
|
+
searchForHits<T>(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: RequestOptions): Promise<{
|
|
1162
|
+
results: Array<SearchResponse<T>>;
|
|
1163
|
+
}>;
|
|
1236
1164
|
/**
|
|
1237
|
-
*
|
|
1165
|
+
* Helper: calls the `search` method but with certainty that we will only request Algolia facets and not records (hits).
|
|
1166
|
+
* Disclaimer: We don't assert that the parameters you pass to this method only contains `facets` requests to prevent impacting search performances, this helper is purely for typing purposes.
|
|
1167
|
+
*
|
|
1168
|
+
* @summary Search multiple indices for `facets`.
|
|
1169
|
+
* @param searchMethodParams - Query requests and strategies. Results will be received in the same order as the queries.
|
|
1170
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1238
1171
|
*/
|
|
1239
|
-
|
|
1172
|
+
searchForFacets(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: RequestOptions): Promise<{
|
|
1173
|
+
results: SearchForFacetValuesResponse[];
|
|
1174
|
+
}>;
|
|
1175
|
+
/**
|
|
1176
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
1177
|
+
*
|
|
1178
|
+
* @param customPost - The customPost object.
|
|
1179
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1180
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
1181
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
1182
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1183
|
+
*/
|
|
1184
|
+
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Retrieves recommendations from selected AI models.
|
|
1187
|
+
*
|
|
1188
|
+
* Required API Key ACLs:
|
|
1189
|
+
* - search.
|
|
1190
|
+
*
|
|
1191
|
+
* @param getRecommendationsParams - The getRecommendationsParams object.
|
|
1192
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1193
|
+
*/
|
|
1194
|
+
getRecommendations(getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams, requestOptions?: RequestOptions): Promise<GetRecommendationsResponse>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
|
|
1197
|
+
*
|
|
1198
|
+
* Required API Key ACLs:
|
|
1199
|
+
* - search.
|
|
1200
|
+
*
|
|
1201
|
+
* @param searchMethodParams - Muli-search request body. Results are returned in the same order as the requests.
|
|
1202
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1203
|
+
*/
|
|
1204
|
+
search<T>(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: RequestOptions): Promise<SearchResponses<T>>;
|
|
1240
1205
|
};
|
|
1241
1206
|
|
|
1242
1207
|
/**
|
|
1243
|
-
*
|
|
1208
|
+
* Access control list permissions.
|
|
1244
1209
|
*/
|
|
1245
|
-
type
|
|
1210
|
+
type Acl = 'addObject' | 'analytics' | 'browse' | 'deleteIndex' | 'deleteObject' | 'editSettings' | 'inference' | 'listIndexes' | 'logs' | 'personalization' | 'recommendation' | 'search' | 'seeUnretrievableAttributes' | 'settings' | 'usage';
|
|
1246
1211
|
|
|
1247
|
-
|
|
1212
|
+
/**
|
|
1213
|
+
* API key object.
|
|
1214
|
+
*/
|
|
1215
|
+
type ApiKey = {
|
|
1248
1216
|
/**
|
|
1249
|
-
*
|
|
1217
|
+
* Permissions that determine the type of API requests this key can make. The required ACL is listed in each endpoint\'s reference. For more information, see [access control list](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl).
|
|
1250
1218
|
*/
|
|
1251
|
-
|
|
1219
|
+
acl: Acl[];
|
|
1252
1220
|
/**
|
|
1253
|
-
*
|
|
1221
|
+
* Description of an API key to help you identify this API key.
|
|
1254
1222
|
*/
|
|
1255
|
-
|
|
1223
|
+
description?: string;
|
|
1256
1224
|
/**
|
|
1257
|
-
*
|
|
1225
|
+
* Index names or patterns that this API key can access. By default, an API key can access all indices in the same application. You can use leading and trailing wildcard characters (`*`): - `dev_*` matches all indices starting with \"dev_\". - `*_dev` matches all indices ending with \"_dev\". - `*_products_*` matches all indices containing \"_products_\".
|
|
1258
1226
|
*/
|
|
1259
|
-
|
|
1227
|
+
indexes?: string[];
|
|
1260
1228
|
/**
|
|
1261
|
-
* Maximum number of
|
|
1229
|
+
* Maximum number of results this API key can retrieve in one query. By default, there\'s no limit.
|
|
1262
1230
|
*/
|
|
1263
|
-
|
|
1264
|
-
|
|
1231
|
+
maxHitsPerQuery?: number;
|
|
1232
|
+
/**
|
|
1233
|
+
* Maximum number of API requests allowed per IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) per hour. If this limit is reached, the API returns an error with status code `429`. By default, there\'s no limit.
|
|
1234
|
+
*/
|
|
1235
|
+
maxQueriesPerIPPerHour?: number;
|
|
1236
|
+
/**
|
|
1237
|
+
* Query parameters to add when making API requests with this API key. To restrict this API key to specific IP addresses, add the `restrictSources` parameter. You can only add a single source, but you can provide a range of IP addresses. Creating an API key fails if the request is made from an IP address that\'s outside the restricted range.
|
|
1238
|
+
*/
|
|
1239
|
+
queryParameters?: string;
|
|
1240
|
+
/**
|
|
1241
|
+
* Allowed HTTP referrers for this API key. By default, all referrers are allowed. You can use leading and trailing wildcard characters (`*`): - `https://algolia.com/_*` allows all referrers starting with \"https://algolia.com/\" - `*.algolia.com` allows all referrers ending with \".algolia.com\" - `*algolia.com*` allows all referrers in the domain \"algolia.com\". Like all HTTP headers, referrers can be spoofed. Don\'t rely on them to secure your data. For more information, see [HTTP referrer restrictions](https://www.algolia.com/doc/guides/security/security-best-practices/#http-referrers-restrictions).
|
|
1242
|
+
*/
|
|
1243
|
+
referers?: string[];
|
|
1244
|
+
/**
|
|
1245
|
+
* Duration (in seconds) after which the API key expires. By default, API keys don\'t expire.
|
|
1246
|
+
*/
|
|
1247
|
+
validity?: number;
|
|
1265
1248
|
};
|
|
1266
1249
|
|
|
1267
|
-
type SearchForFacets = SearchForFacetsOptions & SearchParams;
|
|
1268
|
-
|
|
1269
1250
|
/**
|
|
1270
|
-
*
|
|
1251
|
+
* Filter or optional filter to be applied to the search.
|
|
1271
1252
|
*/
|
|
1272
|
-
type
|
|
1273
|
-
|
|
1274
|
-
type SearchForHitsOptions = {
|
|
1253
|
+
type AutomaticFacetFilter = {
|
|
1275
1254
|
/**
|
|
1276
|
-
*
|
|
1255
|
+
* Facet name to be applied as filter. The name must match placeholders in the `pattern` parameter. For example, with `pattern: {facet:genre}`, `automaticFacetFilters` must be `genre`.
|
|
1277
1256
|
*/
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1257
|
+
facet: string;
|
|
1258
|
+
/**
|
|
1259
|
+
* Filter scores to give different weights to individual filters.
|
|
1260
|
+
*/
|
|
1261
|
+
score?: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* Whether the filter is disjunctive or conjunctive. If true the filter has multiple matches, multiple occurences are combined with the logical `OR` operation. If false, multiple occurences are combined with the logical `AND` operation.
|
|
1264
|
+
*/
|
|
1265
|
+
disjunctive?: boolean;
|
|
1284
1266
|
};
|
|
1285
1267
|
|
|
1286
|
-
type SearchForHits = SearchForHitsOptions & SearchParams;
|
|
1287
|
-
|
|
1288
|
-
type SearchQuery = SearchForFacets | SearchForHits;
|
|
1289
|
-
|
|
1290
1268
|
/**
|
|
1291
|
-
*
|
|
1269
|
+
* Filter to be applied to the search. You can use this to respond to search queries that match a facet value. For example, if users search for \"comedy\", which matches a facet value of the \"genre\" facet, you can filter the results to show the top-ranked comedy movies.
|
|
1292
1270
|
*/
|
|
1293
|
-
type
|
|
1271
|
+
type AutomaticFacetFilters = AutomaticFacetFilter[] | string[];
|
|
1294
1272
|
|
|
1295
|
-
type
|
|
1296
|
-
|
|
1297
|
-
|
|
1273
|
+
type BaseGetApiKeyResponse = {
|
|
1274
|
+
/**
|
|
1275
|
+
* API key.
|
|
1276
|
+
*/
|
|
1277
|
+
value?: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* Timestamp when the object was created, in milliseconds since the Unix epoch.
|
|
1280
|
+
*/
|
|
1281
|
+
createdAt: number;
|
|
1298
1282
|
};
|
|
1299
1283
|
|
|
1300
|
-
type
|
|
1301
|
-
|
|
1302
|
-
|
|
1284
|
+
type BaseIndexSettings = {
|
|
1285
|
+
/**
|
|
1286
|
+
* Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows using this attribute as a filter, but doesn\'t evalue the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`.
|
|
1287
|
+
*/
|
|
1288
|
+
attributesForFaceting?: string[];
|
|
1289
|
+
/**
|
|
1290
|
+
* Creates [replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/). Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you\'ll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index. **Modifier** - `virtual(\"REPLICA\")`. Create a virtual replica, Virtual replicas don\'t increase the number of records and are optimized for [Relevant sorting](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort/).
|
|
1291
|
+
*/
|
|
1292
|
+
replicas?: string[];
|
|
1293
|
+
/**
|
|
1294
|
+
* Maximum number of search results that can be obtained through pagination. Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can\'t be guaranteed.
|
|
1295
|
+
*/
|
|
1296
|
+
paginationLimitedTo?: number;
|
|
1297
|
+
/**
|
|
1298
|
+
* Attributes that can\'t be retrieved at query time. This can be useful if you want to use an attribute for ranking or to [restrict access](https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data/), but don\'t want to include it in the search results. Attribute names are case-sensitive.
|
|
1299
|
+
*/
|
|
1300
|
+
unretrievableAttributes?: string[];
|
|
1301
|
+
/**
|
|
1302
|
+
* Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). This also turns off [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) for the specified words.
|
|
1303
|
+
*/
|
|
1304
|
+
disableTypoToleranceOnWords?: string[];
|
|
1305
|
+
/**
|
|
1306
|
+
* Attributes, for which you want to support [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead). Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive.
|
|
1307
|
+
*/
|
|
1308
|
+
attributesToTransliterate?: string[];
|
|
1309
|
+
/**
|
|
1310
|
+
* Attributes for which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. Attribute names are case-sensitive.
|
|
1311
|
+
*/
|
|
1312
|
+
camelCaseAttributes?: string[];
|
|
1313
|
+
/**
|
|
1314
|
+
* Searchable attributes to which Algolia should apply [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding). Attribute names are case-sensitive. Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, \"firefighter\". With decompounding, the individual components are indexed separately. You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (`nl`), German (`de`), Finnish (`fi`), Danish (`da`), Swedish (`sv`), and Norwegian (`no`). Decompounding doesn\'t work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won\'t be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308).
|
|
1315
|
+
*/
|
|
1316
|
+
decompoundedAttributes?: Record<string, unknown>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Languages for language-specific processing steps, such as word detection and dictionary settings. **You should always specify an indexing language.** If you don\'t specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).
|
|
1319
|
+
*/
|
|
1320
|
+
indexLanguages?: SupportedLanguage[];
|
|
1321
|
+
/**
|
|
1322
|
+
* Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). Attribute names are case-sensitive.
|
|
1323
|
+
*/
|
|
1324
|
+
disablePrefixOnAttributes?: string[];
|
|
1325
|
+
/**
|
|
1326
|
+
* Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.
|
|
1327
|
+
*/
|
|
1328
|
+
allowCompressionOfIntegerArray?: boolean;
|
|
1329
|
+
/**
|
|
1330
|
+
* Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). Attribute names are case-sensitive. By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes. If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn\'t exist in your index, such as `NO_NUMERIC_FILTERING`. **Modifier** - `equalOnly(\"ATTRIBUTE\")`. Support only filtering based on equality comparisons `=` and `!=`.
|
|
1331
|
+
*/
|
|
1332
|
+
numericAttributesForFiltering?: string[];
|
|
1333
|
+
/**
|
|
1334
|
+
* Controls which separators are indexed. Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren\'t indexed. With `separatorsToIndex`, Algolia treats separator characters as separate words. For example, a search for `C#` would report two matches.
|
|
1335
|
+
*/
|
|
1336
|
+
separatorsToIndex?: string;
|
|
1337
|
+
/**
|
|
1338
|
+
* Attributes used for searching. Attribute names are case-sensitive. By default, all attributes are searchable and the [Attribute](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute) ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of `searchableAttributes` rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as `\"title,alternate_title\"`. Attributes with the same priority are always unordered. For more information, see [Searchable attributes](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/setting-searchable-attributes/). **Modifier** - `unordered(\"ATTRIBUTE\")`. Ignore the position of a match within the attribute. Without modifier, matches at the beginning of an attribute rank higer than matches at the end.
|
|
1339
|
+
*/
|
|
1340
|
+
searchableAttributes?: string[];
|
|
1341
|
+
/**
|
|
1342
|
+
* An object with custom data. You can store up to 32kB as custom data.
|
|
1343
|
+
*/
|
|
1344
|
+
userData?: Record<string, unknown>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Characters and their normalized replacements. This overrides Algolia\'s default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).
|
|
1347
|
+
*/
|
|
1348
|
+
customNormalization?: Record<string, Record<string, string>>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts.
|
|
1351
|
+
*/
|
|
1352
|
+
attributeForDistinct?: string;
|
|
1353
|
+
};
|
|
1303
1354
|
|
|
1304
|
-
type
|
|
1305
|
-
|
|
1355
|
+
type BrowsePagination = {
|
|
1356
|
+
/**
|
|
1357
|
+
* Page of search results to retrieve.
|
|
1358
|
+
*/
|
|
1359
|
+
page?: number;
|
|
1360
|
+
/**
|
|
1361
|
+
* Number of results (hits).
|
|
1362
|
+
*/
|
|
1363
|
+
nbHits?: number;
|
|
1364
|
+
/**
|
|
1365
|
+
* Number of pages of results.
|
|
1366
|
+
*/
|
|
1367
|
+
nbPages?: number;
|
|
1368
|
+
/**
|
|
1369
|
+
* Number of hits per page.
|
|
1370
|
+
*/
|
|
1371
|
+
hitsPerPage?: number;
|
|
1306
1372
|
};
|
|
1307
1373
|
|
|
1308
|
-
type
|
|
1374
|
+
type Cursor = {
|
|
1309
1375
|
/**
|
|
1310
|
-
*
|
|
1376
|
+
* Cursor to get the next page of the response. The parameter must match the value returned in the response of a previous request. The last page of the response does not return a `cursor` attribute.
|
|
1311
1377
|
*/
|
|
1312
|
-
|
|
1378
|
+
cursor?: string;
|
|
1313
1379
|
};
|
|
1314
1380
|
|
|
1315
|
-
type
|
|
1381
|
+
type BrowseParamsObject = Cursor & SearchParamsObject;
|
|
1382
|
+
|
|
1383
|
+
type BrowseResponse<T = Record<string, any>> = BaseSearchResponse & BrowsePagination & Cursor & SearchHits<T>;
|
|
1316
1384
|
|
|
1317
1385
|
/**
|
|
1318
|
-
*
|
|
1386
|
+
* Type of edit.
|
|
1319
1387
|
*/
|
|
1320
|
-
type
|
|
1388
|
+
type EditType = 'remove' | 'replace';
|
|
1389
|
+
|
|
1390
|
+
type Edit = {
|
|
1391
|
+
type?: EditType;
|
|
1321
1392
|
/**
|
|
1322
|
-
*
|
|
1393
|
+
* Text or patterns to remove from the query string.
|
|
1323
1394
|
*/
|
|
1324
|
-
|
|
1395
|
+
delete?: string;
|
|
1325
1396
|
/**
|
|
1326
|
-
*
|
|
1397
|
+
* Text to be added in place of the deleted text inside the query string.
|
|
1327
1398
|
*/
|
|
1328
|
-
|
|
1399
|
+
insert?: string;
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1402
|
+
type ConsequenceQueryObject = {
|
|
1329
1403
|
/**
|
|
1330
|
-
*
|
|
1404
|
+
* Words to remove from the search query.
|
|
1331
1405
|
*/
|
|
1332
|
-
|
|
1406
|
+
remove?: string[];
|
|
1407
|
+
/**
|
|
1408
|
+
* Changes to make to the search query.
|
|
1409
|
+
*/
|
|
1410
|
+
edits?: Edit[];
|
|
1333
1411
|
};
|
|
1412
|
+
|
|
1334
1413
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1337
|
-
* @deprecated This signature will be removed from the next major version, we recommend using the `GetRecommendationsParams` type for performances and future proof reasons.
|
|
1414
|
+
* Replace or edit the search query. If `consequenceQuery` is a string, the entire search query is replaced with that string. If `consequenceQuery` is an object, it describes incremental edits made to the query.
|
|
1338
1415
|
*/
|
|
1339
|
-
type
|
|
1416
|
+
type ConsequenceQuery = ConsequenceQueryObject | string;
|
|
1417
|
+
|
|
1340
1418
|
/**
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1343
|
-
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
1419
|
+
* Parameters to apply to this search. You can use all search parameters, plus special `automaticFacetFilters`, `automaticOptionalFacetFilters`, and `query`.
|
|
1344
1420
|
*/
|
|
1345
|
-
type
|
|
1346
|
-
|
|
1421
|
+
type Params = {
|
|
1422
|
+
query?: ConsequenceQuery;
|
|
1423
|
+
automaticFacetFilters?: AutomaticFacetFilters;
|
|
1424
|
+
automaticOptionalFacetFilters?: AutomaticFacetFilters;
|
|
1425
|
+
renderingContent?: RenderingContent;
|
|
1347
1426
|
};
|
|
1427
|
+
|
|
1428
|
+
type ConsequenceParams = BaseSearchParamsWithoutQuery & IndexSettingsAsSearchParams & Params;
|
|
1429
|
+
|
|
1348
1430
|
/**
|
|
1349
|
-
*
|
|
1350
|
-
*
|
|
1351
|
-
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
1352
|
-
*/
|
|
1353
|
-
type LegacySearchForFacets = LegacySearchParams & SearchForFacetsOptions;
|
|
1354
|
-
/**
|
|
1355
|
-
* In v4, the search parameters are wrapped in a `params` parameter.
|
|
1356
|
-
*
|
|
1357
|
-
* @deprecated The `search` method now accepts flat `searchParams` at the root of the method.
|
|
1358
|
-
*/
|
|
1359
|
-
type LegacySearchForHits = LegacySearchParams & SearchForHitsOptions;
|
|
1360
|
-
type LegacySearchQuery = LegacySearchForFacets | LegacySearchForHits;
|
|
1361
|
-
/**
|
|
1362
|
-
* Search method signature compatible with the `algoliasearch` v4 package. When using this signature, extra computation will be required to make it match the new signature.
|
|
1363
|
-
*
|
|
1364
|
-
* @deprecated This signature will be removed from the next major version, we recommend using the `SearchMethodParams` type for performances and future proof reasons.
|
|
1431
|
+
* Error.
|
|
1365
1432
|
*/
|
|
1366
|
-
type
|
|
1433
|
+
type ErrorBase = Record<string, any> & {
|
|
1434
|
+
message?: string;
|
|
1435
|
+
};
|
|
1367
1436
|
|
|
1368
|
-
|
|
1437
|
+
type GetApiKeyResponse = ApiKey & BaseGetApiKeyResponse;
|
|
1369
1438
|
|
|
1370
1439
|
/**
|
|
1371
|
-
*
|
|
1440
|
+
* Index settings.
|
|
1372
1441
|
*/
|
|
1373
|
-
type
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
searchForHits<T>(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: _algolia_client_common.RequestOptions): Promise<{
|
|
1381
|
-
results: Array<SearchResponse<T>>;
|
|
1382
|
-
}>;
|
|
1383
|
-
searchForFacets(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: _algolia_client_common.RequestOptions): Promise<{
|
|
1384
|
-
results: SearchForFacetValuesResponse[];
|
|
1385
|
-
}>;
|
|
1386
|
-
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
|
|
1387
|
-
getRecommendations(getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams, requestOptions?: _algolia_client_common.RequestOptions): Promise<GetRecommendationsResponse>;
|
|
1388
|
-
search<T>(searchMethodParams: LegacySearchMethodProps | SearchMethodParams, requestOptions?: _algolia_client_common.RequestOptions): Promise<SearchResponses<T>>;
|
|
1442
|
+
type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams;
|
|
1443
|
+
|
|
1444
|
+
type WithPrimary = {
|
|
1445
|
+
/**
|
|
1446
|
+
* Replica indices only: the name of the primary index for this replica.
|
|
1447
|
+
*/
|
|
1448
|
+
primary?: string;
|
|
1389
1449
|
};
|
|
1390
1450
|
|
|
1451
|
+
type SettingsResponse = IndexSettings & WithPrimary;
|
|
1452
|
+
|
|
1453
|
+
type LiteClient = ReturnType<typeof createLiteClient>;
|
|
1454
|
+
|
|
1455
|
+
declare function liteClient(appId: string, apiKey: string, options?: ClientOptions): LiteClient;
|
|
1456
|
+
|
|
1391
1457
|
export { type Acl, type AdvancedSyntaxFeatures, type AlternativesAsExact, type ApiKey, type AroundPrecision, type AroundRadius, type AroundRadiusAll, type AutomaticFacetFilter, type AutomaticFacetFilters, type BaseGetApiKeyResponse, type BaseIndexSettings, type BaseRecommendRequest, type BaseSearchParams, type BaseSearchParamsWithoutQuery, type BaseSearchResponse, type BooleanString, type BoughtTogetherQuery, type BrowsePagination, type BrowseParamsObject, type BrowseResponse, type ConsequenceParams, type ConsequenceQuery, type ConsequenceQueryObject, type Cursor, type CustomPostProps, type Distinct, type Edit, type EditType, type ErrorBase, type ExactOnSingleWordQuery, type Exhaustive, type FacetFilters, type FacetHits, type FacetOrdering, type FacetStats, type Facets, type FallbackParams, type FbtModel, type FrequentlyBoughtTogether, type GetApiKeyResponse, type GetRecommendationsParams, type GetRecommendationsResponse, type HighlightResult, type HighlightResultOption, type Hit, type IgnorePlurals, type IndexSettings, type IndexSettingsAsSearchParams, type LegacyGetRecommendationsParams, type LegacySearchMethodProps, type LiteClient, type LookingSimilar, type LookingSimilarModel, type LookingSimilarQuery, type MatchLevel, type MatchedGeoLocation, type Mode, type NumericFilters, type OptionalFilters, type Params, type Personalization, type QueryType, type Range, type RankingInfo, type ReRankingApplyFilter, type RecommendHit, type RecommendationsHit, type RecommendationsHits, type RecommendationsRequest, type RecommendationsResults, type RecommendedForYou, type RecommendedForYouModel, type RecommendedForYouQuery, type Redirect, type RedirectRuleIndexData, type RedirectRuleIndexMetadata, type RedirectURL, type RelatedModel, type RelatedProducts, type RelatedQuery, type RemoveStopWords, type RemoveWordsIfNoResults, type RenderingContent, type SearchForFacetValuesResponse, type SearchForFacets, type SearchForFacetsOptions, type SearchForHits, type SearchForHitsOptions, type SearchHits, type SearchMethodParams, type SearchPagination, type SearchParams, type SearchParamsObject, type SearchParamsQuery, type SearchQuery, type SearchResponse, type SearchResponses, type SearchResult, type SearchStrategy, type SearchTypeDefault, type SearchTypeFacet, type SemanticSearch, type SettingsResponse, type SnippetResult, type SnippetResultOption, type SortRemainingBy, type SupportedLanguage, type TagFilters, type TrendingFacetHit, type TrendingFacets, type TrendingFacetsModel, type TrendingFacetsQuery, type TrendingItems, type TrendingItemsModel, type TrendingItemsQuery, type TypoTolerance, type TypoToleranceEnum, type Value, type WithPrimary, apiClientVersion, liteClient };
|