@algolia/client-search 5.18.0 → 5.20.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/README.md +4 -4
- package/dist/browser.d.ts +26 -17
- package/dist/builds/browser.js +60 -47
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +1 -1
- package/dist/builds/fetch.js +60 -47
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +60 -47
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +60 -47
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +60 -47
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +26 -17
- package/dist/node.d.cts +26 -17
- package/dist/node.d.ts +26 -17
- package/dist/src/searchClient.cjs +60 -47
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +60 -47
- package/dist/src/searchClient.js.map +1 -1
- package/dist/worker.d.ts +26 -17
- package/package.json +10 -10
package/dist/fetch.d.ts
CHANGED
|
@@ -217,14 +217,14 @@ type RedirectURL = {
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
|
-
*
|
|
220
|
+
* URL for an image to show inside a banner.
|
|
221
221
|
*/
|
|
222
222
|
type BannerImageUrl = {
|
|
223
223
|
url?: string;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
227
|
+
* Image to show inside a banner.
|
|
228
228
|
*/
|
|
229
229
|
type BannerImage = {
|
|
230
230
|
urls?: Array<BannerImageUrl>;
|
|
@@ -232,14 +232,14 @@ type BannerImage = {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
*
|
|
235
|
+
* Link for a banner defined in the Merchandising Studio.
|
|
236
236
|
*/
|
|
237
237
|
type BannerLink = {
|
|
238
238
|
url?: string;
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* Banner with image and link to redirect users.
|
|
243
243
|
*/
|
|
244
244
|
type Banner = {
|
|
245
245
|
image?: BannerImage;
|
|
@@ -247,11 +247,11 @@ type Banner = {
|
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
250
|
+
* Widgets returned from any rules that are applied to the current search.
|
|
251
251
|
*/
|
|
252
252
|
type Widgets = {
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
254
|
+
* Banners defined in the Merchandising Studio for a given search.
|
|
255
255
|
*/
|
|
256
256
|
banners?: Array<Banner>;
|
|
257
257
|
};
|
|
@@ -1056,7 +1056,7 @@ type InsideBoundingBox = string | Array<Array<number>>;
|
|
|
1056
1056
|
type NumericFilters = Array<NumericFilters> | string;
|
|
1057
1057
|
|
|
1058
1058
|
/**
|
|
1059
|
-
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters don\'t work with numeric attributes.
|
|
1059
|
+
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters are applied _before_ custom ranking attributes (in the default [ranking](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/)). - Optional filters don\'t work with numeric attributes.
|
|
1060
1060
|
*/
|
|
1061
1061
|
type OptionalFilters = Array<OptionalFilters> | string;
|
|
1062
1062
|
|
|
@@ -1253,10 +1253,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1253
1253
|
* Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they\'re specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/).
|
|
1254
1254
|
*/
|
|
1255
1255
|
ranking?: Array<string>;
|
|
1256
|
-
/**
|
|
1257
|
-
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1258
|
-
*/
|
|
1259
|
-
customRanking?: Array<string>;
|
|
1260
1256
|
/**
|
|
1261
1257
|
* Relevancy threshold below which less relevant results aren\'t included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
|
1262
1258
|
*/
|
|
@@ -1308,10 +1304,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1308
1304
|
disableTypoToleranceOnAttributes?: Array<string>;
|
|
1309
1305
|
ignorePlurals?: IgnorePlurals;
|
|
1310
1306
|
removeStopWords?: RemoveStopWords;
|
|
1311
|
-
/**
|
|
1312
|
-
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1313
|
-
*/
|
|
1314
|
-
keepDiacriticsOnCharacters?: string;
|
|
1315
1307
|
/**
|
|
1316
1308
|
* Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query 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/).
|
|
1317
1309
|
*/
|
|
@@ -1991,6 +1983,14 @@ type BaseIndexSettings = {
|
|
|
1991
1983
|
* 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).
|
|
1992
1984
|
*/
|
|
1993
1985
|
maxFacetHits?: number;
|
|
1986
|
+
/**
|
|
1987
|
+
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1988
|
+
*/
|
|
1989
|
+
keepDiacriticsOnCharacters?: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1992
|
+
*/
|
|
1993
|
+
customRanking?: Array<string>;
|
|
1994
1994
|
};
|
|
1995
1995
|
|
|
1996
1996
|
/**
|
|
@@ -3019,15 +3019,23 @@ type ReplaceAllObjectsOptions = {
|
|
|
3019
3019
|
* The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
3020
3020
|
*/
|
|
3021
3021
|
batchSize?: number;
|
|
3022
|
+
/**
|
|
3023
|
+
* The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3024
|
+
*/
|
|
3025
|
+
scopes?: Array<ScopeType>;
|
|
3022
3026
|
};
|
|
3023
3027
|
|
|
3024
|
-
declare const apiClientVersion = "5.
|
|
3028
|
+
declare const apiClientVersion = "5.20.0";
|
|
3025
3029
|
declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
3026
3030
|
transporter: _algolia_client_common.Transporter;
|
|
3027
3031
|
/**
|
|
3028
3032
|
* The `appId` currently in use.
|
|
3029
3033
|
*/
|
|
3030
3034
|
appId: string;
|
|
3035
|
+
/**
|
|
3036
|
+
* The `apiKey` currently in use.
|
|
3037
|
+
*/
|
|
3038
|
+
apiKey: string;
|
|
3031
3039
|
/**
|
|
3032
3040
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
3033
3041
|
*/
|
|
@@ -3183,9 +3191,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3183
3191
|
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
|
|
3184
3192
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
3185
3193
|
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
|
|
3194
|
+
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3186
3195
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
|
|
3187
3196
|
*/
|
|
3188
|
-
replaceAllObjects({ indexName, objects, batchSize }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3197
|
+
replaceAllObjects({ indexName, objects, batchSize, scopes }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3189
3198
|
indexExists({ indexName }: GetSettingsProps): Promise<boolean>;
|
|
3190
3199
|
/**
|
|
3191
3200
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
package/dist/node.d.cts
CHANGED
|
@@ -217,14 +217,14 @@ type RedirectURL = {
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
|
-
*
|
|
220
|
+
* URL for an image to show inside a banner.
|
|
221
221
|
*/
|
|
222
222
|
type BannerImageUrl = {
|
|
223
223
|
url?: string;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
227
|
+
* Image to show inside a banner.
|
|
228
228
|
*/
|
|
229
229
|
type BannerImage = {
|
|
230
230
|
urls?: Array<BannerImageUrl>;
|
|
@@ -232,14 +232,14 @@ type BannerImage = {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
*
|
|
235
|
+
* Link for a banner defined in the Merchandising Studio.
|
|
236
236
|
*/
|
|
237
237
|
type BannerLink = {
|
|
238
238
|
url?: string;
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* Banner with image and link to redirect users.
|
|
243
243
|
*/
|
|
244
244
|
type Banner = {
|
|
245
245
|
image?: BannerImage;
|
|
@@ -247,11 +247,11 @@ type Banner = {
|
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
250
|
+
* Widgets returned from any rules that are applied to the current search.
|
|
251
251
|
*/
|
|
252
252
|
type Widgets = {
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
254
|
+
* Banners defined in the Merchandising Studio for a given search.
|
|
255
255
|
*/
|
|
256
256
|
banners?: Array<Banner>;
|
|
257
257
|
};
|
|
@@ -1056,7 +1056,7 @@ type InsideBoundingBox = string | Array<Array<number>>;
|
|
|
1056
1056
|
type NumericFilters = Array<NumericFilters> | string;
|
|
1057
1057
|
|
|
1058
1058
|
/**
|
|
1059
|
-
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters don\'t work with numeric attributes.
|
|
1059
|
+
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters are applied _before_ custom ranking attributes (in the default [ranking](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/)). - Optional filters don\'t work with numeric attributes.
|
|
1060
1060
|
*/
|
|
1061
1061
|
type OptionalFilters = Array<OptionalFilters> | string;
|
|
1062
1062
|
|
|
@@ -1253,10 +1253,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1253
1253
|
* Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they\'re specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/).
|
|
1254
1254
|
*/
|
|
1255
1255
|
ranking?: Array<string>;
|
|
1256
|
-
/**
|
|
1257
|
-
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1258
|
-
*/
|
|
1259
|
-
customRanking?: Array<string>;
|
|
1260
1256
|
/**
|
|
1261
1257
|
* Relevancy threshold below which less relevant results aren\'t included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
|
1262
1258
|
*/
|
|
@@ -1308,10 +1304,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1308
1304
|
disableTypoToleranceOnAttributes?: Array<string>;
|
|
1309
1305
|
ignorePlurals?: IgnorePlurals;
|
|
1310
1306
|
removeStopWords?: RemoveStopWords;
|
|
1311
|
-
/**
|
|
1312
|
-
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1313
|
-
*/
|
|
1314
|
-
keepDiacriticsOnCharacters?: string;
|
|
1315
1307
|
/**
|
|
1316
1308
|
* Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query 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/).
|
|
1317
1309
|
*/
|
|
@@ -1991,6 +1983,14 @@ type BaseIndexSettings = {
|
|
|
1991
1983
|
* 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).
|
|
1992
1984
|
*/
|
|
1993
1985
|
maxFacetHits?: number;
|
|
1986
|
+
/**
|
|
1987
|
+
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1988
|
+
*/
|
|
1989
|
+
keepDiacriticsOnCharacters?: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1992
|
+
*/
|
|
1993
|
+
customRanking?: Array<string>;
|
|
1994
1994
|
};
|
|
1995
1995
|
|
|
1996
1996
|
/**
|
|
@@ -3019,15 +3019,23 @@ type ReplaceAllObjectsOptions = {
|
|
|
3019
3019
|
* The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
3020
3020
|
*/
|
|
3021
3021
|
batchSize?: number;
|
|
3022
|
+
/**
|
|
3023
|
+
* The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3024
|
+
*/
|
|
3025
|
+
scopes?: Array<ScopeType>;
|
|
3022
3026
|
};
|
|
3023
3027
|
|
|
3024
|
-
declare const apiClientVersion = "5.
|
|
3028
|
+
declare const apiClientVersion = "5.20.0";
|
|
3025
3029
|
declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
3026
3030
|
transporter: _algolia_client_common.Transporter;
|
|
3027
3031
|
/**
|
|
3028
3032
|
* The `appId` currently in use.
|
|
3029
3033
|
*/
|
|
3030
3034
|
appId: string;
|
|
3035
|
+
/**
|
|
3036
|
+
* The `apiKey` currently in use.
|
|
3037
|
+
*/
|
|
3038
|
+
apiKey: string;
|
|
3031
3039
|
/**
|
|
3032
3040
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
3033
3041
|
*/
|
|
@@ -3183,9 +3191,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3183
3191
|
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
|
|
3184
3192
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
3185
3193
|
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
|
|
3194
|
+
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3186
3195
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
|
|
3187
3196
|
*/
|
|
3188
|
-
replaceAllObjects({ indexName, objects, batchSize }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3197
|
+
replaceAllObjects({ indexName, objects, batchSize, scopes }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3189
3198
|
indexExists({ indexName }: GetSettingsProps): Promise<boolean>;
|
|
3190
3199
|
/**
|
|
3191
3200
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
package/dist/node.d.ts
CHANGED
|
@@ -217,14 +217,14 @@ type RedirectURL = {
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
|
-
*
|
|
220
|
+
* URL for an image to show inside a banner.
|
|
221
221
|
*/
|
|
222
222
|
type BannerImageUrl = {
|
|
223
223
|
url?: string;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
227
|
+
* Image to show inside a banner.
|
|
228
228
|
*/
|
|
229
229
|
type BannerImage = {
|
|
230
230
|
urls?: Array<BannerImageUrl>;
|
|
@@ -232,14 +232,14 @@ type BannerImage = {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
|
-
*
|
|
235
|
+
* Link for a banner defined in the Merchandising Studio.
|
|
236
236
|
*/
|
|
237
237
|
type BannerLink = {
|
|
238
238
|
url?: string;
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* Banner with image and link to redirect users.
|
|
243
243
|
*/
|
|
244
244
|
type Banner = {
|
|
245
245
|
image?: BannerImage;
|
|
@@ -247,11 +247,11 @@ type Banner = {
|
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
250
|
+
* Widgets returned from any rules that are applied to the current search.
|
|
251
251
|
*/
|
|
252
252
|
type Widgets = {
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
254
|
+
* Banners defined in the Merchandising Studio for a given search.
|
|
255
255
|
*/
|
|
256
256
|
banners?: Array<Banner>;
|
|
257
257
|
};
|
|
@@ -1056,7 +1056,7 @@ type InsideBoundingBox = string | Array<Array<number>>;
|
|
|
1056
1056
|
type NumericFilters = Array<NumericFilters> | string;
|
|
1057
1057
|
|
|
1058
1058
|
/**
|
|
1059
|
-
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters don\'t work with numeric attributes.
|
|
1059
|
+
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match. - Optional filters don\'t work on virtual replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters are applied _before_ custom ranking attributes (in the default [ranking](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/)). - Optional filters don\'t work with numeric attributes.
|
|
1060
1060
|
*/
|
|
1061
1061
|
type OptionalFilters = Array<OptionalFilters> | string;
|
|
1062
1062
|
|
|
@@ -1253,10 +1253,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1253
1253
|
* Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they\'re specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/).
|
|
1254
1254
|
*/
|
|
1255
1255
|
ranking?: Array<string>;
|
|
1256
|
-
/**
|
|
1257
|
-
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1258
|
-
*/
|
|
1259
|
-
customRanking?: Array<string>;
|
|
1260
1256
|
/**
|
|
1261
1257
|
* Relevancy threshold below which less relevant results aren\'t included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
|
1262
1258
|
*/
|
|
@@ -1308,10 +1304,6 @@ type IndexSettingsAsSearchParams = {
|
|
|
1308
1304
|
disableTypoToleranceOnAttributes?: Array<string>;
|
|
1309
1305
|
ignorePlurals?: IgnorePlurals;
|
|
1310
1306
|
removeStopWords?: RemoveStopWords;
|
|
1311
|
-
/**
|
|
1312
|
-
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1313
|
-
*/
|
|
1314
|
-
keepDiacriticsOnCharacters?: string;
|
|
1315
1307
|
/**
|
|
1316
1308
|
* Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query 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/).
|
|
1317
1309
|
*/
|
|
@@ -1991,6 +1983,14 @@ type BaseIndexSettings = {
|
|
|
1991
1983
|
* 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).
|
|
1992
1984
|
*/
|
|
1993
1985
|
maxFacetHits?: number;
|
|
1986
|
+
/**
|
|
1987
|
+
* Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
|
1988
|
+
*/
|
|
1989
|
+
keepDiacriticsOnCharacters?: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
|
1992
|
+
*/
|
|
1993
|
+
customRanking?: Array<string>;
|
|
1994
1994
|
};
|
|
1995
1995
|
|
|
1996
1996
|
/**
|
|
@@ -3019,15 +3019,23 @@ type ReplaceAllObjectsOptions = {
|
|
|
3019
3019
|
* The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
3020
3020
|
*/
|
|
3021
3021
|
batchSize?: number;
|
|
3022
|
+
/**
|
|
3023
|
+
* The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3024
|
+
*/
|
|
3025
|
+
scopes?: Array<ScopeType>;
|
|
3022
3026
|
};
|
|
3023
3027
|
|
|
3024
|
-
declare const apiClientVersion = "5.
|
|
3028
|
+
declare const apiClientVersion = "5.20.0";
|
|
3025
3029
|
declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
3026
3030
|
transporter: _algolia_client_common.Transporter;
|
|
3027
3031
|
/**
|
|
3028
3032
|
* The `appId` currently in use.
|
|
3029
3033
|
*/
|
|
3030
3034
|
appId: string;
|
|
3035
|
+
/**
|
|
3036
|
+
* The `apiKey` currently in use.
|
|
3037
|
+
*/
|
|
3038
|
+
apiKey: string;
|
|
3031
3039
|
/**
|
|
3032
3040
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
3033
3041
|
*/
|
|
@@ -3183,9 +3191,10 @@ declare function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
3183
3191
|
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
|
|
3184
3192
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
3185
3193
|
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
|
|
3194
|
+
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
3186
3195
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
|
|
3187
3196
|
*/
|
|
3188
|
-
replaceAllObjects({ indexName, objects, batchSize }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3197
|
+
replaceAllObjects({ indexName, objects, batchSize, scopes }: ReplaceAllObjectsOptions, requestOptions?: RequestOptions): Promise<ReplaceAllObjectsResponse>;
|
|
3189
3198
|
indexExists({ indexName }: GetSettingsProps): Promise<boolean>;
|
|
3190
3199
|
/**
|
|
3191
3200
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
|
@@ -25,7 +25,7 @@ __export(searchClient_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(searchClient_exports);
|
|
27
27
|
var import_client_common = require("@algolia/client-common");
|
|
28
|
-
var apiClientVersion = "5.
|
|
28
|
+
var apiClientVersion = "5.20.0";
|
|
29
29
|
function getDefaultHosts(appId) {
|
|
30
30
|
return [
|
|
31
31
|
{
|
|
@@ -90,6 +90,10 @@ function createSearchClient({
|
|
|
90
90
|
* The `appId` currently in use.
|
|
91
91
|
*/
|
|
92
92
|
appId: appIdOption,
|
|
93
|
+
/**
|
|
94
|
+
* The `apiKey` currently in use.
|
|
95
|
+
*/
|
|
96
|
+
apiKey: apiKeyOption,
|
|
93
97
|
/**
|
|
94
98
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
95
99
|
*/
|
|
@@ -448,57 +452,66 @@ function createSearchClient({
|
|
|
448
452
|
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
|
|
449
453
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
450
454
|
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
|
|
455
|
+
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
451
456
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
|
|
452
457
|
*/
|
|
453
|
-
async replaceAllObjects({ indexName, objects, batchSize }, requestOptions) {
|
|
458
|
+
async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
|
|
454
459
|
const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
|
|
455
460
|
const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
{
|
|
477
|
-
indexName,
|
|
478
|
-
operationIndexParams: {
|
|
479
|
-
operation: "copy",
|
|
480
|
-
destination: tmpIndexName,
|
|
481
|
-
scope: ["settings", "rules", "synonyms"]
|
|
482
|
-
}
|
|
483
|
-
},
|
|
484
|
-
requestOptions
|
|
485
|
-
);
|
|
486
|
-
await this.waitForTask({
|
|
487
|
-
indexName: tmpIndexName,
|
|
488
|
-
taskID: copyOperationResponse.taskID
|
|
489
|
-
});
|
|
490
|
-
const moveOperationResponse = await this.operationIndex(
|
|
491
|
-
{
|
|
461
|
+
if (scopes === void 0) {
|
|
462
|
+
scopes = ["settings", "rules", "synonyms"];
|
|
463
|
+
}
|
|
464
|
+
try {
|
|
465
|
+
let copyOperationResponse = await this.operationIndex(
|
|
466
|
+
{
|
|
467
|
+
indexName,
|
|
468
|
+
operationIndexParams: {
|
|
469
|
+
operation: "copy",
|
|
470
|
+
destination: tmpIndexName,
|
|
471
|
+
scope: scopes
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
requestOptions
|
|
475
|
+
);
|
|
476
|
+
const batchResponses = await this.chunkedBatch(
|
|
477
|
+
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
|
|
478
|
+
requestOptions
|
|
479
|
+
);
|
|
480
|
+
await this.waitForTask({
|
|
492
481
|
indexName: tmpIndexName,
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
482
|
+
taskID: copyOperationResponse.taskID
|
|
483
|
+
});
|
|
484
|
+
copyOperationResponse = await this.operationIndex(
|
|
485
|
+
{
|
|
486
|
+
indexName,
|
|
487
|
+
operationIndexParams: {
|
|
488
|
+
operation: "copy",
|
|
489
|
+
destination: tmpIndexName,
|
|
490
|
+
scope: scopes
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
requestOptions
|
|
494
|
+
);
|
|
495
|
+
await this.waitForTask({
|
|
496
|
+
indexName: tmpIndexName,
|
|
497
|
+
taskID: copyOperationResponse.taskID
|
|
498
|
+
});
|
|
499
|
+
const moveOperationResponse = await this.operationIndex(
|
|
500
|
+
{
|
|
501
|
+
indexName: tmpIndexName,
|
|
502
|
+
operationIndexParams: { operation: "move", destination: indexName }
|
|
503
|
+
},
|
|
504
|
+
requestOptions
|
|
505
|
+
);
|
|
506
|
+
await this.waitForTask({
|
|
507
|
+
indexName: tmpIndexName,
|
|
508
|
+
taskID: moveOperationResponse.taskID
|
|
509
|
+
});
|
|
510
|
+
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
511
|
+
} catch (error) {
|
|
512
|
+
await this.deleteIndex({ indexName: tmpIndexName });
|
|
513
|
+
throw error;
|
|
514
|
+
}
|
|
502
515
|
},
|
|
503
516
|
async indexExists({ indexName }) {
|
|
504
517
|
try {
|