import * as _algolia_client_common from '@algolia/client-common'; import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common'; /** * Type of Composition Batch operation. */ type Action = 'upsert' | 'delete'; /** * Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results. Current configuration supports: - \'highest\': always select the item in the highest position, and remove duplicates that appear lower in the results. - \'highestInjected\': duplicate result will be moved to its highest possible injected position, but not higher. If a duplicate appears higher in main search results, it will be removed to stay it\'s intended group position (which could be lower than main). */ type DedupPositioning = 'highest' | 'highestInjected'; /** * Deduplication configures the methods used to resolve duplicate items between main search results and injected group results. */ type Deduplication = { positioning: DedupPositioning; }; /** * Adds the provided metadata to each injected hit via an `_extra` attribute. */ type InjectedItemHitsMetadata = { /** * When true, the `_injectedItemKey` field is set in the `_extra` object of each affected hit. */ addItemKey?: boolean | undefined; /** * The user-defined key-value pairs that will be placed in the `_extra` field of each affected hit. */ extra?: { [key: string]: any; } | undefined; }; /** * Used to add metadata to the results of the injectedItem. */ type InjectedItemMetadata = { hits?: InjectedItemHitsMetadata | undefined; }; type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords'; type AlternativesAsExact = 'ignorePlurals' | 'singleWordSynonym' | 'multiWordsSynonym' | 'ignoreConjugations'; /** * 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. */ type Distinct = boolean | number; /** * Determines how the [Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes) is computed when the search query has only one word. - `attribute`. The Exact ranking criterion is 1 if the query word and attribute value are the same. For example, a search for \"road\" will match the value \"road\", but not \"road trip\". - `none`. The Exact ranking criterion is ignored on single-word searches. - `word`. The Exact ranking criterion is 1 if the query word is found in the attribute value. The query word must have at least 3 characters and must not be a stop word. Only exact matches will be highlighted, partial and prefix matches won\'t. */ type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word'; /** * 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`. */ type FacetFilters = Array | string; type BooleanString = 'true' | 'false'; /** * ISO code for a supported language. */ 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' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'; /** * Treat singular, plurals, and other forms of declensions as equivalent. Only use this feature for the languages used in your index. */ type IgnorePlurals = Array | BooleanString | boolean; /** * Filter by numeric facets. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** You can use numeric comparison operators: `<`, `<=`, `=`, `!=`, `>`, `>=`. Comparisons are precise up to 3 decimals. You can also provide ranges: `facet: TO `. The range includes the lower and upper boundaries. The same combination rules apply as for `facetFilters`. */ type NumericFilters = Array | string; /** * 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 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. - On virtual replicas, optional filters are applied _after_ the replica\'s [relevant sort](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort). */ type OptionalFilters = Array | string; /** * Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can increase the number of search results by running an additional search query that doesn\'t include the optional words. For example, if the search query is \"action video\" and \"video\" is optional, the search engine runs two queries: one for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has fewer than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word; results 1,001 to 2,000 need 2 matched words. - If `optionalWords` has 10 or more words, the required number of matched words increases by the number of optional words divided by 5 (rounded down). Example: with 18 optional words, results 1 to 1,000 require 1 matched word; results 1,001 to 2,000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). */ type OptionalWords = string | Array; /** * Determines if and how query words are interpreted as prefixes. By default, only the last query word is treated as a prefix (`prefixLast`). To turn off prefix search, use `prefixNone`. Avoid `prefixAll`, which treats all query words as prefixes. This might lead to counterintuitive results and makes your search slower. For more information, see [Prefix searching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching). */ type QueryType = 'prefixLast' | 'prefixAll' | 'prefixNone'; /** * Removes stop words from the search query. Stop words are common words like articles, conjunctions, prepositions, or pronouns that have little or no meaning on their own. In English, \"the\", \"a\", or \"and\" are stop words. Only use this feature for the languages used in your index. */ type RemoveStopWords = Array | boolean; /** * Strategy for removing words from the query when it doesn\'t return any results. This helps to avoid returning empty search results. - `none`. No words are removed when a query doesn\'t return results. - `lastWords`. Treat the last (then second to last, then third to last) word as optional, until there are results or at most 5 words have been removed. - `firstWords`. Treat the first (then second, then third) word as optional, until there are results or at most 5 words have been removed. - `allOptional`. Treat all words as optional. For more information, see [Remove words to improve results](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results). */ type RemoveWordsIfNoResults = 'none' | 'lastWords' | 'firstWords' | 'allOptional'; /** * - `min`. Return matches with the lowest number of typos. For example, if you have matches without typos, only include those. But if there are no matches without typos (with 1 typo), include matches with 1 typo (2 typos). - `strict`. Return matches with the two lowest numbers of typos. With `strict`, the Typo ranking criterion is applied first in the `ranking` setting. */ type TypoToleranceEnum = 'min' | 'strict' | 'true' | 'false'; /** * Whether [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance) is enabled and how it is applied. If typo tolerance is true, `min`, or `strict`, [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation) are also active. */ type TypoTolerance = boolean | TypoToleranceEnum; type BaseInjectionQueryParameters = { /** * Whether to support phrase matching and excluding words from search queries Use the `advancedSyntaxFeatures` parameter to control which feature is supported. */ advancedSyntax?: boolean | undefined; /** * Advanced search syntax features you want to support - `exactPhrase`. Phrases in quotes must match exactly. For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\" - `excludeWords`. Query words prefixed with a `-` must not occur in a record. For example, `search -engine` matches records that contain \"search\" but not \"engine\" This setting only has an effect if `advancedSyntax` is true. */ advancedSyntaxFeatures?: Array | undefined; /** * Whether to allow typos on numbers in the search query Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers. */ allowTyposOnNumericTokens?: boolean | undefined; /** * Determine which plurals and synonyms should be considered an exact matches By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example - \"swimsuit\" and \"swimsuits\" are treated the same - \"swimsuit\" and \"swimwear\" are treated the same (if they are [synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)) - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches - `singleWordSynonym`. Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches - `multiWordsSynonym`. Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches. */ alternativesAsExact?: Array | undefined; /** * Whether the best matching attribute should be determined by minimum proximity This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting. */ attributeCriteriaComputedByMinProximity?: boolean | undefined; /** * Attributes to highlight By default, all searchable attributes are highlighted. Use `*` to highlight all attributes or use an empty array `[]` to turn off highlighting. Attribute names are case-sensitive With highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`. You can use this to visually highlight matching parts of a search query in your UI For more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js). */ attributesToHighlight?: Array | undefined; /** * Attributes to include in the API response To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive - `*` retrieves all attributes, except attributes included in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the `*`: `[\"*\", \"-ATTRIBUTE\"]`. - The `objectID` attribute is always included. */ attributesToRetrieve?: Array | undefined; /** * Attributes for which to enable snippets. Attribute names are case-sensitive Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: `ATTRIBUTE:NUMBER`, where `NUMBER` is the number of words to be extracted. */ attributesToSnippet?: Array | undefined; /** * Whether to include a `queryID` attribute in the response The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started). */ clickAnalytics?: boolean | undefined; /** * Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. */ disableExactOnAttributes?: Array | undefined; /** * Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance). Attribute names are case-sensitive Returning only exact matches can help when - [Searching in hyphenated attributes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/how-to/how-to-search-in-hyphenated-attributes). - Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions Consider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos. */ disableTypoToleranceOnAttributes?: Array | undefined; distinct?: Distinct | undefined; /** * Whether to enable A/B testing for this search. */ enableABTest?: boolean | undefined; /** * Whether to enable Personalization. */ enablePersonalization?: boolean | undefined; /** * Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. */ enableReRanking?: boolean | undefined; /** * Whether to enable rules. */ enableRules?: boolean | undefined; exactOnSingleWordQuery?: ExactOnSingleWordQuery | undefined; facetFilters?: FacetFilters | undefined; /** * Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO `, where `` and `` are the lower and upper limits of the range (inclusive). - **Facet filters.** `:`, where `` is a facet attribute (case-sensitive) and `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can\'t use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can\'t combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes if the facet attribute name or facet value contains spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering). */ filters?: string | undefined; /** * Whether the search response should include detailed ranking information. */ getRankingInfo?: boolean | undefined; /** * HTML tag to insert after the highlighted parts in all highlighted results and snippets. */ highlightPostTag?: string | undefined; /** * HTML tag to insert before the highlighted parts in all highlighted results and snippets. */ highlightPreTag?: string | undefined; ignorePlurals?: IgnorePlurals | undefined; /** * Minimum proximity score for two matching words This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score. */ minProximity?: number | undefined; /** * Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). */ minWordSizefor1Typo?: number | undefined; /** * Minimum number of characters a word in the search query must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). */ minWordSizefor2Typos?: number | undefined; /** * ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches) - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`. */ naturalLanguages?: Array | undefined; numericFilters?: NumericFilters | undefined; optionalFilters?: OptionalFilters | undefined; optionalWords?: OptionalWords | null | undefined; /** * Whether to include this search when calculating processing-time percentiles. */ percentileComputation?: boolean | undefined; /** * Impact that Personalization should have on this search The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). */ personalizationImpact?: number | undefined; /** * 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, place the CJK language **first**. **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). */ queryLanguages?: Array | undefined; queryType?: QueryType | undefined; removeStopWords?: RemoveStopWords | undefined; removeWordsIfNoResults?: RemoveWordsIfNoResults | undefined; /** * Whether to replace a highlighted word with the matched synonym By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of \"house\" are replaced by \"home\" in the highlighted response. */ replaceSynonymsInHighlight?: boolean | undefined; /** * Properties to include in the API response of search and browse requests By default, all response properties are included. To reduce the response size, you can select which properties should be included An empty list may lead to an empty API response (except properties you can\'t exclude) You can\'t exclude these properties: `message`, `warning`, `cursor`, `abTestVariantID`, or any property added by setting `getRankingInfo` to true Your search depends on the `hits` field. If you omit this field, searches won\'t return any results. Your UI might also depend on other properties, for example, for pagination. Before restricting the response size, check the impact on your search experience. */ responseFields?: Array | undefined; /** * Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted. */ restrictHighlightAndSnippetArrays?: boolean | undefined; /** * Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive. */ restrictSearchableAttributes?: Array | undefined; /** * Assigns a rule context to the search query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. */ ruleContexts?: Array | undefined; /** * String used as an ellipsis indicator when a snippet is truncated. */ snippetEllipsisText?: string | undefined; /** * Whether to take into account an index\'s synonyms for this search. */ synonyms?: boolean | undefined; typoTolerance?: TypoTolerance | undefined; }; /** * Ordering to apply on the injected items coming from the external source. \'default\' means the items will be ordered as they are in the index (natural relevance) in the smart group. \'userDefined\' means the order in which the objectIDs are provided in the run request payload will be preserved in the smart group. */ type ExternalOrdering = 'default' | 'userDefined'; type InjectedItemExternal = { /** * Composition Index name. */ index: string; params?: BaseInjectionQueryParameters | undefined; ordering?: ExternalOrdering | undefined; }; /** * Injected items will originate from externally provided objectIDs (that must exist in the index) given at runtime in the run request payload. */ type InjectedItemExternalSource = { external: InjectedItemExternal; }; /** * Recommendation model to use for retrieving recommendations. */ type Model = 'trending-items'; type Recommend = { /** * Index to retrieve recommendations from. */ indexName: string; model: Model; /** * Minimum score a recommendation must have to be included. */ threshold: number; queryParameters?: BaseInjectionQueryParameters | undefined; fallbackParameters?: BaseInjectionQueryParameters | undefined; }; /** * Injected items will originate from a recommendation request performed on the specified index. */ type InjectedItemRecommendSource = { recommend: Recommend; }; type InjectedItemSearch = { /** * Composition Index name. */ index: string; params?: BaseInjectionQueryParameters | undefined; }; /** * Injected items will originate from a search request performed on the specified index. */ type InjectedItemSearchSource = { search: InjectedItemSearch; }; type InjectedItemSource = InjectedItemSearchSource | InjectedItemExternalSource | InjectedItemRecommendSource; type InjectionInjectedItem = { /** * injected Item unique identifier. */ key: string; source: InjectedItemSource; position: number; length: number; metadata?: InjectedItemMetadata | undefined; }; type MainInjectionQueryParameters = BaseInjectionQueryParameters & Record; type MainRecommend = { /** * Index to retrieve recommendations from. */ indexName: string; model: Model; /** * Minimum score a recommendation must have to be included. */ threshold: number; queryParameters?: MainInjectionQueryParameters | undefined; fallbackParameters?: MainInjectionQueryParameters | undefined; }; /** * Organic result set will originate from a recommend request. */ type InjectionMainRecommendSource = { recommend: MainRecommend; }; type MainSearch = { /** * Index to retrieve search results from. */ index: string; params?: MainInjectionQueryParameters | undefined; }; /** * Organic result set will originate from a search request performed on the specified index. */ type InjectionMainSearchSource = { search: MainSearch; }; /** * Source to be used to retrieve organic result set. */ type InjectionMainSource = InjectionMainSearchSource | InjectionMainRecommendSource; /** * Main defines the organic result set of the injection. */ type InjectionMain = { source?: InjectionMainSource | undefined; }; type Injection = { main: InjectionMain; /** * list of injected items of the current Composition. */ injectedItems?: Array | undefined; deduplication?: Deduplication | undefined; }; /** * An object containing an `injection` behavior. */ type CompositionInjectionBehavior = { injection: Injection; }; /** * Feed formatted as an injection. */ type FeedInjection = { injection: Injection; }; type Multifeed = { /** * A key-value store of Feed ID to Feed. Currently, the only supported Feed type is an Injection. */ feeds: { [key: string]: FeedInjection; }; /** * A list of Feed IDs that specifies the order in which to order the results in the response. The IDs should be a subset of those in the Feeds object, and only those specified will be processed. When this field is not set, all Feeds are processed and returned with a default ordering. */ feedsOrder?: Array | undefined; }; /** * An object containing a `multifeed` behavior. */ type CompositionMultifeedBehavior = { multifeed: Multifeed; }; /** * An object containing either an `injection` or `multifeed` behavior schema, but not both. */ type CompositionBehavior = CompositionInjectionBehavior | CompositionMultifeedBehavior; type Composition = { /** * Composition unique identifier. */ objectID: string; /** * Composition name. */ name: string; /** * Composition description. */ description?: string | undefined; behavior: CompositionBehavior; /** * A mapping of sorting labels to the indices (or replicas) that implement those sorting rules. The sorting indices MUST be related to the associated main targeted index in the composition. Each key is the label your frontend sends at runtime (for example, \"Price (asc)\"), and each value is the name of the index that should be queried when that label is selected. When a request includes a \"sortBy\" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main targeted index is replaced with the sorting strategy index it is mapped to. Up to 20 sorting strategies can be defined. */ sortingStrategy?: { [key: string]: string; } | undefined; }; /** * Operation arguments when deleting. */ type DeleteCompositionAction = { /** * Composition unique identifier. */ objectID: string; }; type BatchCompositionAction = Composition | DeleteCompositionAction; type MultipleBatchRequest = { action: Action; body: BatchCompositionAction; }; /** * Batch parameters. */ type BatchParams = { requests: Array; }; /** * Effect of the rule. */ type CompositionRuleConsequence = { behavior: CompositionBehavior; }; /** * Which part of the search query the pattern should match: - `startsWith`. The pattern must match the beginning of the query. - `endsWith`. The pattern must match the end of the query. - `is`. The pattern must match the query exactly. - `contains`. The pattern must match anywhere in the query. Empty queries are only allowed as patterns with `anchoring: is`. */ type Anchoring = 'is' | 'startsWith' | 'endsWith' | 'contains'; type Condition = { /** * Query pattern that triggers the rule. You can use either a literal string, or a special pattern `{facet:ATTRIBUTE}`, where `ATTRIBUTE` is a facet name. The rule is triggered if the query matches the literal string or a value of the specified facet. For example, with `pattern: {facet:genre}`, the rule is triggered when users search for a genre, such as \"comedy\". */ pattern?: string | undefined; anchoring?: Anchoring | undefined; /** * An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter. For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`. A rule context must only contain alphanumeric characters. */ context?: string | undefined; /** * Filters that trigger the rule. You can add add filters using the syntax `facet:value` so that the rule is triggered, when the specific filter is selected. You can use `filters` on its own or combine it with the `pattern` parameter. */ filters?: string | undefined; /** * Sort criteria that trigger the rule. You can trigger composition rules based on the selected sorting strategy set by the parameter `sortBy`. The rule will trigger if the value passed to `sortBy` matches the one defined in the condition. */ sortBy?: string | undefined; }; type TimeRange = { /** * Timestamp when the rule should start to be active, measured in seconds since the Unix epoch. */ from?: number | undefined; /** * Timestamp when the rule should stop to be active, measured in seconds since the Unix epoch. */ until?: number | undefined; }; type CompositionRule = { /** * Composition rule unique identifier. */ objectID: string; /** * Conditions that trigger a composition rule. */ conditions?: Array | undefined; consequence: CompositionRuleConsequence; /** * Description of the rule\'s purpose to help you distinguish between different rules. */ description?: string | undefined; /** * Whether the rule is active. */ enabled?: boolean | undefined; /** * Time periods when the rule is active. */ validity?: Array | undefined; /** * A list of tags. */ tags?: Array | undefined; }; /** * Task status, `published` if the task is completed, `notPublished` otherwise. */ type TaskStatus = 'published' | 'notPublished'; type GetTaskResponse = { status: TaskStatus; }; type ListCompositionsResponse = { /** * All compositions in your Algolia application. */ items: Array; /** * Number of pages. */ nbPages: number; /** * Current page. */ page: number; /** * Number of items per page. */ hitsPerPage: number; /** * Number of items. */ nbHits: number; }; type MultipleBatchResponse = { /** * Task IDs. One for each index. */ taskID: { [key: string]: number; }; }; type RulesMultipleBatchResponse = { /** * Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID. */ taskID: number; }; type SearchCompositionRulesResponse = { /** * Composition rules that matched the search criteria. */ hits: Array; /** * Number of composition rules that matched the search criteria. */ nbHits: number; /** * Current page. */ page: number; /** * Number of pages. */ nbPages: number; }; type FacetHits = { /** * Facet value. */ value: string; /** * Highlighted attribute value, including HTML tags. */ highlighted: string; /** * Number of records with this facet value. [The count may be approximated](https://support.algolia.com/hc/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate). */ count: number; }; type SearchForFacetValuesResults = { indexName: string; /** * Matching facet values. */ facetHits: Array; /** * 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/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate). */ exhaustiveFacetsCount: boolean; /** * Time the server took to process the request, in milliseconds. */ processingTimeMS?: number | undefined; }; type SearchForFacetValuesResponse = { /** * Search for facet values results. */ results?: Array | undefined; }; type CompositionRunAppliedRules = { /** * The objectID of the applied composition rule on this query. */ objectID: string; }; type CompositionRunSearchResponse = Record & { /** * The objectID of the composition which generated this result set. */ objectID: string; appliedRules?: Array | undefined; }; type CompositionsSearchResponse = Record & { run: Array; }; type CompositionBaseSearchResponse = { compositions?: CompositionsSearchResponse | undefined; }; /** * Whether certain properties of the search response are calculated exhaustive (exact) or approximated. */ type Exhaustive = { /** * Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate). */ facetsCount?: boolean | undefined; /** * The value is `false` if not all facet values are retrieved. */ facetValues?: boolean | undefined; /** * 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. */ nbHits?: boolean | undefined; /** * 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. */ rulesMatch?: boolean | undefined; /** * 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. */ typo?: boolean | undefined; }; type FacetStats = { /** * Minimum value in the results. */ min?: number | undefined; /** * Maximum value in the results. */ max?: number | undefined; /** * Average facet value in the results. */ avg?: number | undefined; /** * Sum of all values in the results. */ sum?: number | undefined; }; /** * Redirect rule data. */ type RedirectRuleIndexData = { ruleObjectID: string; }; type RedirectRuleIndexMetadata = { /** * Source index for the redirect rule. */ source: string; /** * Destination index for the redirect rule. */ dest: string; /** * Reason for the redirect rule. */ reason: string; /** * Redirect rule status. */ succeed: boolean; data: RedirectRuleIndexData; }; /** * [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. */ type Redirect = { index?: Array | undefined; }; /** * Order of facet names. */ type IndexSettingsFacets = { /** * Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. */ order?: Array | undefined; }; /** * Order of facet values that aren\'t explicitly positioned with the `order` setting. - `count`. Order remaining facet values by decreasing count. The count is the number of matching records containing this facet value. - `alpha`. Sort facet values alphabetically. - `hidden`. Don\'t show facet values that aren\'t explicitly positioned. */ type SortRemainingBy = 'count' | 'alpha' | 'hidden'; type Value = { /** * Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. */ order?: Array | undefined; sortRemainingBy?: SortRemainingBy | undefined; /** * Hide facet values. */ hide?: Array | undefined; }; /** * Order of facet names and facet values in your UI. */ type FacetOrdering = { facets?: IndexSettingsFacets | undefined; /** * Order of facet values. One object for each facet. */ values?: { [key: string]: Value; } | undefined; }; /** * The redirect rule container. */ type RedirectURL = { url?: string | undefined; }; /** * URL for an image to show inside a banner. */ type BannerImageUrl = { url?: string | undefined; }; /** * Image to show inside a banner. */ type BannerImage = { urls?: Array | undefined; title?: string | undefined; }; /** * Link for a banner defined in the Merchandising Studio. */ type BannerLink = { url?: string | undefined; }; /** * Banner with image and link to redirect users. */ type Banner = { image?: BannerImage | undefined; link?: BannerLink | undefined; }; /** * Widgets returned from any rules that are applied to the current search. */ type Widgets = { /** * Banners defined in the Merchandising Studio for a given search. */ banners?: Array | undefined; }; /** * Extra data that can be used in the search UI. You can use this to control aspects of your search UI, such as the order of facet names and values without changing your frontend code. */ type RenderingContent = { facetOrdering?: FacetOrdering | undefined; redirect?: RedirectURL | undefined; widgets?: Widgets | undefined; }; type BaseSearchResponse = Record & { /** * A/B test ID. This is only included in the response for indices that are part of an A/B test. */ abTestID?: number | undefined; /** * Variant ID. This is only included in the response for indices that are part of an A/B test. */ abTestVariantID?: number | undefined; /** * Computed geographical location. */ aroundLatLng?: string | undefined; /** * Distance from a central coordinate provided by `aroundLatLng`. */ automaticRadius?: string | undefined; exhaustive?: Exhaustive | undefined; /** * Rules applied to the query. */ appliedRules?: Array> | undefined; /** * See the `facetsCount` field of the `exhaustive` object in the response. */ exhaustiveFacetsCount?: boolean | undefined; /** * See the `nbHits` field of the `exhaustive` object in the response. */ exhaustiveNbHits?: boolean | undefined; /** * See the `typo` field of the `exhaustive` object in the response. */ exhaustiveTypo?: boolean | undefined; /** * Facet counts. */ facets?: { [key: string]: { [key: string]: number; }; } | undefined; /** * Statistics for numerical facets. */ facets_stats?: { [key: string]: FacetStats; } | undefined; /** * Index name used for the query. */ index?: string | undefined; /** * Index name used for the query. During A/B testing, the targeted index isn\'t always the index used by the query. */ indexUsed?: string | undefined; /** * Warnings about the query. */ message?: string | undefined; /** * Number of hits selected and sorted by the relevant sort algorithm. */ nbSortedHits?: number | undefined; /** * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. */ parsedQuery?: string | undefined; /** * Time the server took to process the request, in milliseconds. */ processingTimeMS?: number | undefined; /** * Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. */ processingTimingsMS?: Record | undefined; /** * Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. */ queryAfterRemoval?: string | undefined; redirect?: Redirect | undefined; renderingContent?: RenderingContent | undefined; /** * Time the server took to process the request, in milliseconds. */ serverTimeMS?: number | undefined; /** * Host name of the server that processed the request. */ serverUsed?: string | undefined; /** * An object with custom data. You can store up to 32kB as custom data. */ userData?: any | null | undefined; /** * Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics). */ queryID?: string | undefined; /** * Whether automatic events collection is enabled for the application. */ _automaticInsights?: boolean | undefined; }; type ResultsInjectedItemAppliedRulesInfoResponse = { /** * The objectID of the applied index level rule on this injected group. */ objectID: string; }; type ResultsInjectedItemInfoResponse = Record & { /** * The key of the injected group. */ key: string; appliedRules?: Array | undefined; }; type ResultsCompositionInfoResponse = { injectedItems: Array; }; type ResultsCompositionsResponse = { /** * The ID of the feed. */ feedID?: string | undefined; compositions: { [key: string]: ResultsCompositionInfoResponse; }; }; /** * Whether the whole query string matches or only a part. */ type MatchLevel = 'none' | 'partial' | 'full'; /** * Surround words that match the query with HTML tags for highlighting. */ type HighlightResultOption = { /** * Highlighted attribute value, including HTML tags. */ value: string; matchLevel: MatchLevel; /** * List of matched words from the search query. */ matchedWords: Array; /** * Whether the entire attribute value is highlighted. */ fullyHighlighted?: boolean | undefined; }; type HighlightResult = HighlightResultOption | { [key: string]: HighlightResult; } | Array; /** * An object that contains the extra key-value pairs provided in the injectedItem definition. */ type HitMetadata = Record & { /** * The key of the injectedItem that inserted this metadata. */ _injectedItemKey?: string | undefined; }; type CompositionIdRankingInfo = { index: string; injectedItemKey: string; }; type CompositionRankingInfo = { composed?: { [key: string]: CompositionIdRankingInfo; } | undefined; }; type MatchedGeoLocation = { /** * Latitude of the matched location. */ lat?: number | undefined; /** * Longitude of the matched location. */ lng?: number | undefined; /** * Distance between the matched location and the search location (in meters). */ distance?: number | undefined; }; type Personalization = { /** * The score of the filters. */ filtersScore?: number | undefined; /** * The score of the ranking. */ rankingScore?: number | undefined; /** * The score of the event. */ score?: number | undefined; }; /** * Object with detailed information about the record\'s ranking. */ type RankingInfo = { /** * Whether a filter matched the query. */ filters?: number | undefined; /** * Position of the first matched word in the best matching attribute of the record. */ firstMatchedWord: number; /** * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). */ geoDistance: number; /** * Precision used when computing the geo distance, in meters. */ geoPrecision?: number | undefined; matchedGeoLocation?: MatchedGeoLocation | undefined; personalization?: Personalization | undefined; /** * Number of exactly matched words. */ nbExactWords: number; /** * Number of typos encountered when matching the record. */ nbTypos: number; /** * Whether the record was promoted by a rule. */ promoted?: boolean | undefined; /** * Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0. */ proximityDistance?: number | undefined; /** * Overall ranking of the record, expressed as a single integer. This attribute is internal. */ userScore: number; /** * Number of matched words. */ words?: number | undefined; /** * Whether the record is re-ranked. */ promotedByReRanking?: boolean | undefined; }; type HitRankingInfo = RankingInfo & CompositionRankingInfo; /** * Snippets that show the context around a matching search query. */ type SnippetResultOption = { /** * Highlighted attribute value, including HTML tags. */ value: string; matchLevel: MatchLevel; }; type SnippetResult = SnippetResultOption | { [key: string]: SnippetResult; } | Array; /** * Search result. A hit is a record from your index, augmented with special attributes for highlighting, snippeting, and ranking. */ type Hit> = T & { /** * Unique record identifier. */ objectID: string; /** * Surround words that match the query with HTML tags for highlighting. */ _highlightResult?: { [key: string]: HighlightResult; } | undefined; /** * Snippets that show the context around a matching search query. */ _snippetResult?: { [key: string]: SnippetResult; } | undefined; _rankingInfo?: HitRankingInfo | undefined; _distinctSeqID?: number | undefined; _extra?: HitMetadata | undefined; }; type SearchFields> = { /** * Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting. */ hits?: Hit[] | undefined; /** * Number of hits returned per page. */ hitsPerPage?: number | undefined; /** * Number of results (hits). */ nbHits?: number | undefined; /** * Number of pages of results. */ nbPages?: number | undefined; /** * The current page of the results. */ page?: number | undefined; /** * URL-encoded string of all search parameters. */ params?: string | undefined; /** * The search query string. */ query?: string | undefined; }; type SearchResultsItem> = BaseSearchResponse & SearchFields & ResultsCompositionsResponse; type SearchResults> = { /** * Search results. */ results: SearchResultsItem[]; }; type SearchResponse> = CompositionBaseSearchResponse & SearchResults; type TaskIDResponse = { /** * Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](https://www.algolia.com/doc/rest-api/search/get-task) and this task ID. */ taskID: number; }; /** * Operation arguments when deleting. */ type DeleteCompositionRuleAction = { /** * Composition rule unique identifier. */ objectID: string; }; type RulesBatchCompositionAction = CompositionRule | DeleteCompositionRuleAction; type RulesMultipleBatchRequest = { action: Action; body: RulesBatchCompositionAction; }; /** * Composition rules batch parameters. */ type CompositionRulesBatchParams = { requests?: Array | undefined; }; /** * Range object with lower and upper values in meters to define custom ranges. */ type Range = { /** * Lower boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. */ from?: number | undefined; /** * Upper boundary of a range in meters. The Geo ranking criterion considers all records within the range to be equal. */ value?: number | undefined; }; /** * Precision of a coordinate-based search in meters to group results with similar distances. The Geo ranking criterion considers all matches within the same range of distances to be equal. */ type AroundPrecision = number | Array; /** * Return all records with a valid `_geoloc` attribute. Don\'t filter by distance. */ type AroundRadiusAll = 'all'; /** * Maximum radius for a search around a central location. This parameter works in combination with the `aroundLatLng` and `aroundLatLngViaIP` parameters. By default, the search radius is determined automatically from the density of hits around the central location. The search radius is small if there are many hits close to the central coordinates. */ type AroundRadius = number | AroundRadiusAll; type ExternalInjection = { /** * An objectID injected from an external source and also present in the targeted index. */ objectID: string; /** * User-defined key-values that will be added to the injected item in the response. This is identical to Hits metadata defined in Composition or Composition Rule, with the benefit of being set at runtime. */ metadata?: { [key: string]: any; } | undefined; }; /** * Contains a list of objects to inject from an external source. */ type ExternalInjectedItem = { items: Array; }; type InsideBoundingBox = string | Array>; type Params = { /** * Whether this search will be included in Analytics. */ analytics?: boolean | undefined; /** * Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments). */ analyticsTags?: Array | undefined; /** * Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within a circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. */ aroundLatLng?: string | undefined; /** * Whether to obtain the coordinates from the request\'s IP address. */ aroundLatLngViaIP?: boolean | undefined; aroundRadius?: AroundRadius | undefined; aroundPrecision?: AroundPrecision | undefined; /** * Whether to include a `queryID` attribute in the response The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started). */ clickAnalytics?: boolean | undefined; /** * Whether to enable index level A/B testing for this run request. If the composition mixes multiple indices, the A/B test is ignored. */ enableABTest?: boolean | undefined; /** * Whether to enable Personalization. */ enablePersonalization?: boolean | undefined; /** * Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. */ enableReRanking?: boolean | undefined; /** * Whether to enable composition rules. */ enableRules?: boolean | undefined; facetFilters?: FacetFilters | undefined; /** * Facets for which to retrieve facet values that match the search criteria and the number of matching facet values To retrieve all facets, use the wildcard character `*`. To retrieve disjunctive facets lists, annotate any facets with the `disjunctive` modifier. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts) and [disjunctive faceting for Smart Groups](https://www.algolia.com/doc/guides/managing-results/compositions/search-based-groups#facets-including-disjunctive-faceting). */ facets?: Array | undefined; /** * Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO `, where `` and `` are the lower and upper limits of the range (inclusive). - **Facet filters.** `:`, where `` is a facet attribute (case-sensitive) and `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can\'t use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can\'t combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes if the facet attribute name or facet value contains spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering). */ filters?: string | undefined; /** * Whether the run response should include detailed ranking information. */ getRankingInfo?: boolean | undefined; /** * Number of hits per page. */ hitsPerPage?: number | undefined; /** * An object containing keys corresponding to the `key`s from an injection\'s `injectedItems` and values containing a list of hits to inject. */ injectedItems?: { [key: string]: ExternalInjectedItem; } | undefined; insideBoundingBox?: InsideBoundingBox | null | undefined; /** * Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. */ insidePolygon?: Array> | undefined; /** * Minimum radius (in meters) for a search around a location when `aroundRadius` isn\'t set. */ minimumAroundRadius?: number | undefined; /** * ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches) - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`. */ naturalLanguages?: Array | undefined; numericFilters?: NumericFilters | undefined; optionalFilters?: OptionalFilters | undefined; /** * Page of search results to retrieve. */ page?: number | undefined; /** * Search query. */ query?: string | undefined; /** * 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, place the CJK language **first**. **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). */ queryLanguages?: Array | undefined; /** * 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. */ relevancyStrictness?: number | undefined; /** * Assigns a rule context to the run query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. */ ruleContexts?: Array | undefined; /** * Indicates which sorting strategy to apply for the request. The value must match one of the labels defined in the \"sortingStrategy\" mapping. For example, \"Price (asc)\", see Upsert Composition. At runtime, this label is used to look up the corresponding index or replica configured in \"sortingStrategy\", and the query is executed using that index instead of main\'s. In addition to \"sortingStrategy\", this parameter is also used to apply a matching Composition Rule that contains a condition defined to trigger on \"sortBy\", see Composition Rules. If no value is provided or an invalid value, no sorting strategy is applied. */ sortBy?: string | undefined; /** * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken). */ userToken?: string | undefined; }; type RequestBody = { params?: Params | undefined; /** * A list of Feed IDs that specifies the order in which to order the results in the response. The IDs should be a subset of those in the `feeds` object of the targeted `multifeed` Composition / Composition Rule, and only those specified will be processed. The value overrides the value in the defined behavior, and when unspecified, the value defined in the behavior is used. When neither value is present, all feeds are processed. */ feedsOrder?: Array | undefined; }; /** * Composition Rules search parameters. */ type SearchCompositionRulesParams = { /** * Search query for rules. */ query?: string | undefined; anchoring?: Anchoring | undefined; /** * Only return composition rules that match the context (exact match). */ context?: string | undefined; /** * Requested page of the API response. Algolia uses `page` and `hitsPerPage` to control how search results are displayed ([paginated](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js)). - `hitsPerPage`: sets the number of search results (_hits_) displayed per page. - `page`: specifies the page number of the search results you want to retrieve. Page numbering starts at 0, so the first page is `page=0`, the second is `page=1`, and so on. For example, to display 10 results per page starting from the third page, set `hitsPerPage` to 10 and `page` to 2. */ page?: number | undefined; /** * Maximum number of hits per page. Algolia uses `page` and `hitsPerPage` to control how search results are displayed ([paginated](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js)). - `hitsPerPage`: sets the number of search results (_hits_) displayed per page. - `page`: specifies the page number of the search results you want to retrieve. Page numbering starts at 0, so the first page is `page=0`, the second is `page=1`, and so on. For example, to display 10 results per page starting from the third page, set `hitsPerPage` to 10 and `page` to 2. */ hitsPerPage?: number | undefined; /** * If `true`, return only enabled composition rules. If `false`, return only inactive composition rules. By default, _all_ composition rules are returned. */ enabled?: boolean | null | undefined; }; type SearchForFacetValuesParams = { /** * Search query. */ query?: string | undefined; /** * 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). */ maxFacetHits?: number | undefined; searchQuery?: Params | undefined; }; type SearchForFacetValuesRequest = { params?: SearchForFacetValuesParams | undefined; }; /** * Properties for the `customDelete` method. */ type CustomDeleteProps = { /** * Path of the endpoint, for example `1/newFeature`. */ path: string; /** * Query parameters to apply to the current query. */ parameters?: { [key: string]: any; } | undefined; }; /** * Properties for the `customGet` method. */ type CustomGetProps = { /** * Path of the endpoint, for example `1/newFeature`. */ path: string; /** * Query parameters to apply to the current query. */ parameters?: { [key: string]: any; } | undefined; }; /** * Properties for the `customPost` method. */ type CustomPostProps = { /** * Path of the endpoint, for example `1/newFeature`. */ path: string; /** * Query parameters to apply to the current query. */ parameters?: { [key: string]: any; } | undefined; /** * Parameters to send with the custom request. */ body?: Record | undefined; }; /** * Properties for the `customPut` method. */ type CustomPutProps = { /** * Path of the endpoint, for example `1/newFeature`. */ path: string; /** * Query parameters to apply to the current query. */ parameters?: { [key: string]: any; } | undefined; /** * Parameters to send with the custom request. */ body?: Record | undefined; }; /** * Properties for the `deleteComposition` method. */ type DeleteCompositionProps = { /** * Unique Composition ObjectID. */ compositionID: string; }; /** * Properties for the `deleteCompositionRule` method. */ type DeleteCompositionRuleProps = { /** * Unique Composition ObjectID. */ compositionID: string; /** * Unique identifier of a rule object. */ objectID: string; }; /** * Properties for the `getComposition` method. */ type GetCompositionProps = { /** * Unique Composition ObjectID. */ compositionID: string; }; /** * Properties for the `getRule` method. */ type GetRuleProps = { /** * Unique Composition ObjectID. */ compositionID: string; /** * Unique identifier of a rule object. */ objectID: string; }; /** * Properties for the `getTask` method. */ type GetTaskProps = { /** * Unique Composition ObjectID. */ compositionID: string; /** * Unique task identifier. */ taskID: number; }; /** * Properties for the `listCompositions` method. */ type ListCompositionsProps = { /** * Requested page of the API response. If `null`, the API response is not paginated. */ page?: number | undefined; /** * Number of hits per page. */ hitsPerPage?: number | undefined; }; /** * Properties for the `putComposition` method. */ type PutCompositionProps = { /** * Unique Composition ObjectID. */ compositionID: string; composition: Composition; }; /** * Properties for the `putCompositionRule` method. */ type PutCompositionRuleProps = { /** * Unique Composition ObjectID. */ compositionID: string; /** * Unique identifier of a rule object. */ objectID: string; compositionRule: CompositionRule; }; /** * Properties for the `saveRules` method. */ type SaveRulesProps = { /** * Unique Composition ObjectID. */ compositionID: string; rules: CompositionRulesBatchParams; }; /** * Properties for the `search` method. */ type SearchProps = { /** * Unique Composition ObjectID. */ compositionID: string; requestBody: RequestBody; }; /** * Properties for the `searchCompositionRules` method. */ type SearchCompositionRulesProps = { /** * Unique Composition ObjectID. */ compositionID: string; searchCompositionRulesParams?: SearchCompositionRulesParams | undefined; }; /** * Properties for the `searchForFacetValues` method. */ type SearchForFacetValuesProps = { /** * Unique Composition ObjectID. */ compositionID: string; /** * Facet attribute in which to search for values. This attribute must be included in the `attributesForFaceting` index setting with the `searchable()` modifier. */ facetName: string; searchForFacetValuesRequest?: SearchForFacetValuesRequest | undefined; }; /** * Properties for the `updateSortingStrategyComposition` method. */ type UpdateSortingStrategyCompositionProps = { /** * Unique Composition ObjectID. */ compositionID: string; requestBody: { [key: string]: string; }; }; type WaitForCompositionTaskOptions = { /** * The maximum number of retries. 100 by default. */ maxRetries?: number | undefined; /** * The function to decide how long to wait between retries. */ timeout?: (retryCount: number) => number; /** * The `taskID` returned by the method response. */ taskID: number; /** * The `compositionID` where the operation was performed. */ compositionID: string; }; declare const apiClientVersion = "1.28.0"; declare function createCompositionClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): { transporter: _algolia_client_common.Transporter; /** * The `appId` currently in use. */ appId: string; /** * The `apiKey` currently in use. */ apiKey: string; /** * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties. */ clearCache(): Promise; /** * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system. */ readonly _ua: string; /** * Adds a `segment` to the `x-algolia-agent` sent with every requests. * * @param segment - The algolia agent (user-agent) segment to add. * @param version - The version of the agent. */ addAlgoliaAgent(segment: string, version?: string | undefined): void; /** * Helper method to switch the API key used to authenticate the requests. * * @param params - Method params. * @param params.apiKey - The new API Key to use. */ setClientApiKey({ apiKey }: { apiKey: string; }): void; /** * Helper: Wait for a composition-level task to be published (completed) for a given `compositionID` and `taskID`. * * @summary Helper method that waits for a task to be published (completed). * @param WaitForCompositionTaskOptions - The `WaitForCompositionTaskOptions` object. * @param WaitForCompositionTaskOptions.compositionID - The `compositionID` where the operation was performed. * @param WaitForCompositionTaskOptions.taskID - The `taskID` returned in the method response. * @param WaitForCompositionTaskOptions.maxRetries - The maximum number of retries. 100 by default. * @param WaitForCompositionTaskOptions.timeout - The function to decide how long to wait between retries. * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions. */ waitForCompositionTask({ compositionID, taskID, maxRetries, timeout, }: WaitForCompositionTaskOptions, requestOptions?: RequestOptions): Promise; /** * This method lets you send requests to the Algolia REST API. * @param customDelete - The customDelete object. * @param customDelete.path - Path of the endpoint, for example `1/newFeature`. * @param customDelete.parameters - Query parameters to apply to the current query. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise>; /** * This method lets you send requests to the Algolia REST API. * @param customGet - The customGet object. * @param customGet.path - Path of the endpoint, for example `1/newFeature`. * @param customGet.parameters - Query parameters to apply to the current query. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise>; /** * This method lets you send requests to the Algolia REST API. * @param customPost - The customPost object. * @param customPost.path - Path of the endpoint, for example `1/newFeature`. * @param customPost.parameters - Query parameters to apply to the current query. * @param customPost.body - Parameters to send with the custom request. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise>; /** * This method lets you send requests to the Algolia REST API. * @param customPut - The customPut object. * @param customPut.path - Path of the endpoint, for example `1/newFeature`. * @param customPut.parameters - Query parameters to apply to the current query. * @param customPut.body - Parameters to send with the custom request. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise>; /** * Delete a composition from the current Algolia application. * * Required API Key ACLs: * - editSettings * @param deleteComposition - The deleteComposition object. * @param deleteComposition.compositionID - Unique Composition ObjectID. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteComposition({ compositionID }: DeleteCompositionProps, requestOptions?: RequestOptions): Promise; /** * Delete a Composition Rule from the specified Composition ID. * * Required API Key ACLs: * - editSettings * @param deleteCompositionRule - The deleteCompositionRule object. * @param deleteCompositionRule.compositionID - Unique Composition ObjectID. * @param deleteCompositionRule.objectID - Unique identifier of a rule object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteCompositionRule({ compositionID, objectID }: DeleteCompositionRuleProps, requestOptions?: RequestOptions): Promise; /** * Retrieve a single composition in the current Algolia application. * * Required API Key ACLs: * - editSettings * - settings * @param getComposition - The getComposition object. * @param getComposition.compositionID - Unique Composition ObjectID. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getComposition({ compositionID }: GetCompositionProps, requestOptions?: RequestOptions): Promise; /** * Retrieves a rule by its ID. To find the object ID of a rule, use the [`search` operation](https://www.algolia.com/doc/rest-api/composition/search-composition-rules). * * Required API Key ACLs: * - editSettings * - settings * @param getRule - The getRule object. * @param getRule.compositionID - Unique Composition ObjectID. * @param getRule.objectID - Unique identifier of a rule object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getRule({ compositionID, objectID }: GetRuleProps, requestOptions?: RequestOptions): Promise; /** * Checks the status of a given task. * * Required API Key ACLs: * - editSettings * - settings * - addObject * - deleteObject * - deleteIndex * @param getTask - The getTask object. * @param getTask.compositionID - Unique Composition ObjectID. * @param getTask.taskID - Unique task identifier. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTask({ compositionID, taskID }: GetTaskProps, requestOptions?: RequestOptions): Promise; /** * Lists all compositions in the current Algolia application. * * Required API Key ACLs: * - editSettings * - settings * @param listCompositions - The listCompositions object. * @param listCompositions.page - Requested page of the API response. If `null`, the API response is not paginated. * @param listCompositions.hitsPerPage - Number of hits per page. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listCompositions({ page, hitsPerPage }?: ListCompositionsProps, requestOptions?: RequestOptions | undefined): Promise; /** * Adds, updates, or deletes compositions with a single API request. * * Required API Key ACLs: * - editSettings * @param batchParams - The batchParams object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ multipleBatch(batchParams: BatchParams, requestOptions?: RequestOptions): Promise; /** * Update and insert a composition in the current Algolia application. * * Required API Key ACLs: * - editSettings * @param putComposition - The putComposition object. * @param putComposition.compositionID - Unique Composition ObjectID. * @param putComposition.composition - The composition object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ putComposition({ compositionID, composition }: PutCompositionProps, requestOptions?: RequestOptions): Promise; /** * If a composition rule with the provided ID already exists, it\'s replaced. Otherwise, a new one is added. * * Required API Key ACLs: * - editSettings * @param putCompositionRule - The putCompositionRule object. * @param putCompositionRule.compositionID - Unique Composition ObjectID. * @param putCompositionRule.objectID - Unique identifier of a rule object. * @param putCompositionRule.compositionRule - The compositionRule object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ putCompositionRule({ compositionID, objectID, compositionRule }: PutCompositionRuleProps, requestOptions?: RequestOptions): Promise; /** * Create or update or delete multiple composition rules. * * Required API Key ACLs: * - editSettings * @param saveRules - The saveRules object. * @param saveRules.compositionID - Unique Composition ObjectID. * @param saveRules.rules - The rules object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ saveRules({ compositionID, rules }: SaveRulesProps, requestOptions?: RequestOptions): Promise; /** * Runs a query on a single composition and returns matching results. * * Required API Key ACLs: * - search * @param search - The search object. * @param search.compositionID - Unique Composition ObjectID. * @param search.requestBody - The requestBody object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ search({ compositionID, requestBody }: SearchProps, requestOptions?: RequestOptions): Promise>; /** * Searches for composition rules in your index. * * Required API Key ACLs: * - settings * @param searchCompositionRules - The searchCompositionRules object. * @param searchCompositionRules.compositionID - Unique Composition ObjectID. * @param searchCompositionRules.searchCompositionRulesParams - The searchCompositionRulesParams object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchCompositionRules({ compositionID, searchCompositionRulesParams }: SearchCompositionRulesProps, requestOptions?: RequestOptions): Promise; /** * Searches for values of a specified facet attribute on the composition\'s main source\'s index. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn\'t work if you have **more than 65 searchable facets and searchable attributes combined**. * * Required API Key ACLs: * - search * @param searchForFacetValues - The searchForFacetValues object. * @param searchForFacetValues.compositionID - Unique Composition ObjectID. * @param searchForFacetValues.facetName - Facet attribute in which to search for values. This attribute must be included in the `attributesForFaceting` index setting with the `searchable()` modifier. * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchForFacetValues({ compositionID, facetName, searchForFacetValuesRequest }: SearchForFacetValuesProps, requestOptions?: RequestOptions): Promise; /** * Updates the \"sortingStrategy\" field of an existing composition. This endpoint lets you create a new sorting strategy mapping or replace the configured one. The provided sorting indices must be associated indices or replicas of the main targeted index. This endpoint can\'t validate whether the sort index is related to the composition\'s main index. Validation fails at runtime if the index you updated isn\'t related. The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion. * * Required API Key ACLs: * - editSettings * @param updateSortingStrategyComposition - The updateSortingStrategyComposition object. * @param updateSortingStrategyComposition.compositionID - Unique Composition ObjectID. * @param updateSortingStrategyComposition.requestBody - The requestBody object. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ updateSortingStrategyComposition({ compositionID, requestBody }: UpdateSortingStrategyCompositionProps, requestOptions?: RequestOptions): Promise; }; /** * Error. */ type ErrorBase = Record & { message?: string | undefined; }; type CompositionClient = ReturnType; declare function compositionClient(appId: string, apiKey: string, options?: ClientOptions | undefined): CompositionClient; export { type Action, type AdvancedSyntaxFeatures, type AlternativesAsExact, type Anchoring, type AroundPrecision, type AroundRadius, type AroundRadiusAll, type Banner, type BannerImage, type BannerImageUrl, type BannerLink, type BaseInjectionQueryParameters, type BaseSearchResponse, type BatchCompositionAction, type BatchParams, type BooleanString, type Composition, type CompositionBaseSearchResponse, type CompositionBehavior, type CompositionClient, type CompositionIdRankingInfo, type CompositionInjectionBehavior, type CompositionMultifeedBehavior, type CompositionRankingInfo, type CompositionRule, type CompositionRuleConsequence, type CompositionRulesBatchParams, type CompositionRunAppliedRules, type CompositionRunSearchResponse, type CompositionsSearchResponse, type Condition, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DedupPositioning, type Deduplication, type DeleteCompositionAction, type DeleteCompositionProps, type DeleteCompositionRuleAction, type DeleteCompositionRuleProps, type Distinct, type ErrorBase, type ExactOnSingleWordQuery, type Exhaustive, type ExternalInjectedItem, type ExternalInjection, type ExternalOrdering, type FacetFilters, type FacetHits, type FacetOrdering, type FacetStats, type FeedInjection, type GetCompositionProps, type GetRuleProps, type GetTaskProps, type GetTaskResponse, type HighlightResult, type HighlightResultOption, type Hit, type HitMetadata, type HitRankingInfo, type IgnorePlurals, type IndexSettingsFacets, type InjectedItemExternal, type InjectedItemExternalSource, type InjectedItemHitsMetadata, type InjectedItemMetadata, type InjectedItemRecommendSource, type InjectedItemSearch, type InjectedItemSearchSource, type InjectedItemSource, type Injection, type InjectionInjectedItem, type InjectionMain, type InjectionMainRecommendSource, type InjectionMainSearchSource, type InjectionMainSource, type InsideBoundingBox, type ListCompositionsProps, type ListCompositionsResponse, type MainInjectionQueryParameters, type MainRecommend, type MainSearch, type MatchLevel, type MatchedGeoLocation, type Model, type Multifeed, type MultipleBatchRequest, type MultipleBatchResponse, type NumericFilters, type OptionalFilters, type OptionalWords, type Params, type Personalization, type PutCompositionProps, type PutCompositionRuleProps, type QueryType, type Range, type RankingInfo, type Recommend, type Redirect, type RedirectRuleIndexData, type RedirectRuleIndexMetadata, type RedirectURL, type RemoveStopWords, type RemoveWordsIfNoResults, type RenderingContent, type RequestBody, type ResultsCompositionInfoResponse, type ResultsCompositionsResponse, type ResultsInjectedItemAppliedRulesInfoResponse, type ResultsInjectedItemInfoResponse, type RulesBatchCompositionAction, type RulesMultipleBatchRequest, type RulesMultipleBatchResponse, type SaveRulesProps, type SearchCompositionRulesParams, type SearchCompositionRulesProps, type SearchCompositionRulesResponse, type SearchFields, type SearchForFacetValuesParams, type SearchForFacetValuesProps, type SearchForFacetValuesRequest, type SearchForFacetValuesResponse, type SearchForFacetValuesResults, type SearchProps, type SearchResponse, type SearchResults, type SearchResultsItem, type SnippetResult, type SnippetResultOption, type SortRemainingBy, type SupportedLanguage, type TaskIDResponse, type TaskStatus, type TimeRange, type TypoTolerance, type TypoToleranceEnum, type UpdateSortingStrategyCompositionProps, type Value, type WaitForCompositionTaskOptions, type Widgets, apiClientVersion, compositionClient };