{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/algolia/main/json-schema/algolia-composition-rule-schema.json", "title": "compositionRule", "x-generated": "2026-09-23", "x-method": "derived", "x-generator": "derive-json-schema.py", "x-source": "openapi/algolia-composition-api-openapi.yml#/components/schemas/compositionRule", "type": "object", "additionalProperties": false, "properties": { "objectID": { "$ref": "#/$defs/compositionRuleObjectID" }, "conditions": { "type": "array", "minItems": 0, "maxItems": 25, "description": "Conditions that trigger a composition rule.", "items": { "$ref": "#/$defs/condition" } }, "consequence": { "title": "compositionRuleConsequence", "type": "object", "description": "Effect of the rule.", "additionalProperties": false, "properties": { "behavior": { "$ref": "#/$defs/compositionBehavior" } }, "required": [ "behavior" ] }, "description": { "type": "string", "description": "Description of the rule's purpose to help you distinguish between different rules." }, "enabled": { "type": "boolean", "default": true, "description": "Whether the rule is active." }, "validity": { "type": "array", "description": "Time periods when the rule is active.", "items": { "$ref": "#/$defs/timeRange" } }, "tags": { "type": "array", "description": "A list of tags.", "items": { "type": "string" } } }, "required": [ "objectID", "consequence" ], "$defs": { "Behaviour_feedID": { "type": "object", "oneOf": [ { "$ref": "#/$defs/feedInjection" } ] }, "IndexSettings_advancedSyntaxFeatures": { "type": "array", "items": { "$ref": "#/$defs/advancedSyntaxFeatures" }, "description": "Advanced search syntax features you want to support\n- `exactPhrase`.\n Phrases in quotes must match exactly.\n For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\"\n- `excludeWords`.\n Query words prefixed with a `-` must not occur in a record.\n For example, `search -engine` matches records that contain \"search\" but not \"engine\"\nThis setting only has an effect if `advancedSyntax` is true.\n", "default": [ "exactPhrase", "excludeWords" ], "x-categories": [ "Query strategy" ] }, "IndexSettings_alternativesAsExact": { "type": "array", "items": { "$ref": "#/$defs/alternativesAsExact" }, "description": "Determine which plurals and synonyms should be considered an exact matches\nBy 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.\nFor example\n- \"swimsuit\" and \"swimsuits\" are treated the same\n- \"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))\n- `ignorePlurals`.\n Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches\n- `singleWordSynonym`.\n Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches\n- `multiWordsSynonym`.\n Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches.\n", "default": [ "ignorePlurals", "singleWordSynonym" ], "x-categories": [ "Query strategy" ] }, "IndexSettings_enableRules": { "type": "boolean", "description": "Whether to enable rules.", "default": true, "x-categories": [ "Rules" ] }, "IndexSettings_facets": { "description": "Order of facet names.", "type": "object", "additionalProperties": false, "properties": { "order": { "$ref": "#/$defs/order" } } }, "SearchParams_enableABTest": { "type": "boolean", "description": "Whether to enable A/B testing for this search.", "default": true, "x-categories": [ "Advanced" ] }, "SearchParams_getRankingInfo": { "type": "boolean", "description": "Whether the search response should include detailed ranking information.", "default": false, "x-categories": [ "Advanced" ] }, "SearchParams_ruleContexts": { "type": "array", "items": { "type": "string" }, "description": "Assigns a rule context to the search query\n[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.\n", "default": [], "x-categories": [ "Rules" ] }, "advancedSyntax": { "type": "boolean", "description": "Whether to support phrase matching and excluding words from search queries\nUse the `advancedSyntaxFeatures` parameter to control which feature is supported.\n", "default": false, "x-categories": [ "Query strategy" ] }, "advancedSyntaxFeatures": { "type": "string", "enum": [ "exactPhrase", "excludeWords" ], "x-categories": [ "Query strategy" ] }, "allowTyposOnNumericTokens": { "type": "boolean", "description": "Whether to allow typos on numbers in the search query\nTurn off this setting to reduce the number of irrelevant matches\nwhen searching in large sets of similar numbers.\n", "default": true, "x-categories": [ "Typos" ] }, "alternativesAsExact": { "type": "string", "enum": [ "ignorePlurals", "singleWordSynonym", "multiWordsSynonym", "ignoreConjugations" ], "x-categories": [ "Query strategy" ] }, "anchoring": { "type": "string", "description": "Which part of the search query the pattern should match:\n\n- `startsWith`. The pattern must match the beginning of the query.\n- `endsWith`. The pattern must match the end of the query.\n- `is`. The pattern must match the query exactly.\n- `contains`. The pattern must match anywhere in the query.\n\nEmpty queries are only allowed as patterns with `anchoring: is`.\n", "enum": [ "is", "startsWith", "endsWith", "contains" ] }, "attributeCriteriaComputedByMinProximity": { "type": "boolean", "description": "Whether the best matching attribute should be determined by minimum proximity\nThis setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting.\nIf true, the best matching attribute is selected based on the minimum proximity of multiple matches.\nOtherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting.\n", "default": false, "x-categories": [ "Advanced" ] }, "attributesToHighlight": { "type": "array", "items": { "type": "string" }, "description": "Attributes to highlight\nBy default, all searchable attributes are highlighted.\nUse `*` to highlight all attributes or use an empty array `[]` to turn off highlighting.\nAttribute names are case-sensitive\nWith highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`.\nYou can use this to visually highlight matching parts of a search query in your UI\nFor more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js).\n", "x-categories": [ "Highlighting and Snippeting" ] }, "attributesToRetrieve": { "type": "array", "items": { "type": "string" }, "description": "Attributes to include in the API response\nTo reduce the size of your response, you can retrieve only some of the attributes.\nAttribute names are case-sensitive\n- `*` retrieves all attributes, except attributes included in the `customRanking` and `unretrievableAttributes` settings.\n- To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the `*`: `[\"*\", \"-ATTRIBUTE\"]`.\n- The `objectID` attribute is always included.\n", "default": [ "*" ], "x-categories": [ "Attributes" ] }, "attributesToSnippet": { "type": "array", "items": { "type": "string" }, "description": "Attributes for which to enable snippets.\nAttribute names are case-sensitive\nSnippets provide additional context to matched words.\nIf you enable snippets, they include 10 words, including the matched word.\nThe matched word will also be wrapped by HTML tags for highlighting.\nYou can adjust the number of words with the following notation: `ATTRIBUTE:NUMBER`,\nwhere `NUMBER` is the number of words to be extracted.\n", "default": [], "x-categories": [ "Highlighting and Snippeting" ] }, "banner": { "description": "Banner with image and link to redirect users.", "type": "object", "additionalProperties": false, "properties": { "image": { "$ref": "#/$defs/bannerImage" }, "link": { "$ref": "#/$defs/bannerLink" } } }, "bannerImage": { "description": "Image to show inside a banner.", "type": "object", "additionalProperties": false, "properties": { "urls": { "type": "array", "items": { "$ref": "#/$defs/bannerImageUrl" } }, "title": { "type": "string" } } }, "bannerImageUrl": { "description": "URL for an image to show inside a banner.", "type": "object", "additionalProperties": false, "properties": { "url": { "type": "string" } } }, "bannerLink": { "description": "Link for a banner defined in the Merchandising Studio.", "type": "object", "additionalProperties": false, "properties": { "url": { "type": "string" } } }, "banners": { "description": "Banners defined in the Merchandising Studio for a given search.", "type": "array", "items": { "$ref": "#/$defs/banner" } }, "baseInjectionQueryParameters": { "title": "Composition common query parameters between main and injected items as object", "type": "object", "additionalProperties": false, "properties": { "advancedSyntax": { "$ref": "#/$defs/advancedSyntax" }, "advancedSyntaxFeatures": { "$ref": "#/$defs/IndexSettings_advancedSyntaxFeatures" }, "allowTyposOnNumericTokens": { "$ref": "#/$defs/allowTyposOnNumericTokens" }, "alternativesAsExact": { "$ref": "#/$defs/IndexSettings_alternativesAsExact" }, "attributeCriteriaComputedByMinProximity": { "$ref": "#/$defs/attributeCriteriaComputedByMinProximity" }, "attributesToHighlight": { "$ref": "#/$defs/attributesToHighlight" }, "attributesToRetrieve": { "$ref": "#/$defs/attributesToRetrieve" }, "attributesToSnippet": { "$ref": "#/$defs/attributesToSnippet" }, "clickAnalytics": { "$ref": "#/$defs/clickAnalytics" }, "disableExactOnAttributes": { "$ref": "#/$defs/disableExactOnAttributes" }, "disableTypoToleranceOnAttributes": { "$ref": "#/$defs/disableTypoToleranceOnAttributes" }, "distinct": { "$ref": "#/$defs/distinct" }, "enableABTest": { "$ref": "#/$defs/SearchParams_enableABTest" }, "enablePersonalization": { "$ref": "#/$defs/enablePersonalization" }, "enableReRanking": { "$ref": "#/$defs/enableReRanking" }, "enableRules": { "$ref": "#/$defs/IndexSettings_enableRules" }, "exactOnSingleWordQuery": { "$ref": "#/$defs/exactOnSingleWordQuery" }, "facetFilters": { "$ref": "#/$defs/facetFilters" }, "filters": { "$ref": "#/$defs/filters" }, "getRankingInfo": { "$ref": "#/$defs/SearchParams_getRankingInfo" }, "highlightPostTag": { "$ref": "#/$defs/highlightPostTag" }, "highlightPreTag": { "$ref": "#/$defs/highlightPreTag" }, "ignorePlurals": { "$ref": "#/$defs/ignorePlurals" }, "minProximity": { "$ref": "#/$defs/minProximity" }, "minWordSizefor1Typo": { "$ref": "#/$defs/minWordSizefor1Typo" }, "minWordSizefor2Typos": { "$ref": "#/$defs/minWordSizefor2Typos" }, "naturalLanguages": { "$ref": "#/$defs/naturalLanguages" }, "numericFilters": { "$ref": "#/$defs/numericFilters" }, "optionalFilters": { "$ref": "#/$defs/optionalFilters" }, "optionalWords": { "$ref": "#/$defs/optionalWords" }, "percentileComputation": { "$ref": "#/$defs/percentileComputation" }, "personalizationImpact": { "$ref": "#/$defs/personalizationImpact" }, "queryLanguages": { "$ref": "#/$defs/queryLanguages" }, "queryType": { "$ref": "#/$defs/queryType" }, "removeStopWords": { "$ref": "#/$defs/removeStopWords" }, "removeWordsIfNoResults": { "$ref": "#/$defs/removeWordsIfNoResults" }, "replaceSynonymsInHighlight": { "$ref": "#/$defs/replaceSynonymsInHighlight" }, "responseFields": { "$ref": "#/$defs/responseFields" }, "restrictHighlightAndSnippetArrays": { "$ref": "#/$defs/restrictHighlightAndSnippetArrays" }, "restrictSearchableAttributes": { "$ref": "#/$defs/restrictSearchableAttributes" }, "ruleContexts": { "$ref": "#/$defs/SearchParams_ruleContexts" }, "snippetEllipsisText": { "$ref": "#/$defs/snippetEllipsisText" }, "synonyms": { "$ref": "#/$defs/synonyms" }, "typoTolerance": { "$ref": "#/$defs/typoTolerance" } } }, "booleanString": { "type": "string", "enum": [ "true", "false" ] }, "clickAnalytics": { "type": "boolean", "description": "Whether to include a `queryID` attribute in the response\nThe 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).\n", "default": false, "x-categories": [ "Analytics" ] }, "compositionBehavior": { "type": "object", "additionalProperties": false, "description": "An object containing either an `injection` or `multifeed` behavior schema, but not both.", "oneOf": [ { "$ref": "#/$defs/compositionInjectionBehavior" }, { "$ref": "#/$defs/compositionMultifeedBehavior" } ] }, "compositionInjectionBehavior": { "type": "object", "additionalProperties": false, "description": "An object containing an `injection` behavior.", "properties": { "injection": { "$ref": "#/$defs/injection" } }, "required": [ "injection" ] }, "compositionMultifeedBehavior": { "type": "object", "additionalProperties": false, "description": "An object containing a `multifeed` behavior.", "properties": { "multifeed": { "$ref": "#/$defs/multifeed" } }, "required": [ "multifeed" ] }, "compositionRuleObjectID": { "type": "string", "description": "Composition rule unique identifier." }, "condition": { "type": "object", "additionalProperties": false, "properties": { "pattern": { "type": "string", "description": "Query pattern that triggers the rule.\n\nYou can use either a literal string, or a special pattern `{facet:ATTRIBUTE}`, where `ATTRIBUTE` is a facet name.\nThe rule is triggered if the query matches the literal string or a value of the specified facet.\nFor example, with `pattern: {facet:genre}`, the rule is triggered when users search for a genre, such as \"comedy\".\n" }, "anchoring": { "$ref": "#/$defs/anchoring" }, "context": { "$ref": "#/$defs/context" }, "filters": { "type": "string", "description": "Filters that trigger the rule.\n\nYou can add add filters using the syntax `facet:value` so that the rule is triggered, when the specific filter is selected.\nYou can use `filters` on its own or combine it with the `pattern` parameter.\n" }, "sortBy": { "type": "string", "description": "Sort criteria that trigger the rule.\n\nYou can trigger composition rules based on the selected sorting strategy set by the parameter `sortBy`.\nThe rule will trigger if the value passed to `sortBy` matches the one defined in the condition.\n" } } }, "context": { "type": "string", "pattern": "[A-Za-z0-9_-]+", "description": "An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter.\nFor example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`.\nA rule context must only contain alphanumeric characters.\n" }, "dedupPositioning": { "type": "string", "enum": [ "highest", "highestInjected" ], "description": "Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results.\nCurrent configuration supports:\n- 'highest': always select the item in the highest position, and remove duplicates that appear lower in the results.\n- 'highestInjected': duplicate result will be moved to its highest possible injected position, but not higher. \n 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).\n", "default": "highestInjected" }, "disableExactOnAttributes": { "type": "array", "items": { "type": "string" }, "description": "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).\nAttribute names are case-sensitive\nThis can be useful for attributes with long values, where the likelihood of an exact match is high,\nsuch as product descriptions.\nTurning off the Exact ranking criterion for these attributes favors exact matching on other attributes.\nThis reduces the impact of individual attributes with a lot of content on ranking.\n", "default": [], "x-categories": [ "Query strategy" ] }, "disableTypoToleranceOnAttributes": { "type": "array", "items": { "type": "string" }, "description": "Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance).\nAttribute names are case-sensitive\nReturning only exact matches can help when\n- [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).\n- Reducing the number of matches when you have too many.\n This can happen with attributes that are long blocks of text, such as product descriptions\nConsider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos.\n", "default": [], "x-categories": [ "Typos" ] }, "distinct": { "description": "Determines how many records of a group are included in the search results.\n\nRecords with the same value for the `attributeForDistinct` attribute are considered a group.\nThe `distinct` setting controls how many members of the group are returned.\nThis is useful for [deduplication and grouping](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature).\n\nThe `distinct` setting is ignored if `attributeForDistinct` is not set.\n", "oneOf": [ { "type": "boolean", "description": "Whether deduplication is turned on. If true, only one member of a group is shown in the search results." }, { "type": "integer", "description": "Number of members of a group of records to include in the search results.\n\n- Don't use `distinct > 1` for records that might be [promoted by rules](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/promote-hits).\n The number of hits won't be correct and faceting won't work as expected.\n- With `distinct > 1`, the `hitsPerPage` parameter controls the number of returned groups.\n For example, with `hitsPerPage: 10` and `distinct: 2`, up to 20 records are returned.\n Likewise, the `nbHits` response attribute contains the number of returned groups.\n", "minimum": 0, "maximum": 4, "default": 0 } ], "x-categories": [ "Advanced" ] }, "enablePersonalization": { "type": "boolean", "description": "Whether to enable Personalization.", "default": false, "x-categories": [ "Personalization" ] }, "enableReRanking": { "type": "boolean", "description": "Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking)\nThis setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.\n", "default": true, "x-categories": [ "Filtering" ] }, "exactOnSingleWordQuery": { "type": "string", "enum": [ "attribute", "none", "word" ], "description": "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.\n\n- `attribute`.\n The Exact ranking criterion is 1 if the query word and attribute value are the same.\n For example, a search for \"road\" will match the value \"road\", but not \"road trip\".\n\n- `none`.\n The Exact ranking criterion is ignored on single-word searches.\n\n- `word`.\n The Exact ranking criterion is 1 if the query word is found in the attribute value.\n The query word must have at least 3 characters and must not be a stop word.\n Only exact matches will be highlighted,\n partial and prefix matches won't.\n", "default": "attribute", "x-categories": [ "Query strategy" ] }, "externalOrdering": { "description": "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.", "enum": [ "default", "userDefined" ], "default": "default" }, "facetFilters": { "description": "Filter the search by facet values, so that only records with the same facet values are retrieved.\n\n**Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.**\n\n- `[filter1, filter2]` is interpreted as `filter1 AND filter2`.\n- `[[filter1, filter2], filter3]` is interpreted as `filter1 OR filter2 AND filter3`.\n- `facet:-value` is interpreted as `NOT facet:value`.\n\nWhile it's best to avoid attributes that start with a `-`, you can still filter them by escaping with a backslash:\n`facet:\\-value`.\n", "oneOf": [ { "type": "array", "items": { "$ref": "#/$defs/facetFilters" } }, { "type": "string" } ], "x-categories": [ "Filtering" ] }, "facetOrdering": { "description": "Order of facet names and facet values in your UI.", "type": "object", "additionalProperties": false, "properties": { "facets": { "$ref": "#/$defs/IndexSettings_facets" }, "values": { "$ref": "#/$defs/values" } } }, "facetingAfterDistinct": { "type": "boolean", "description": "Whether faceting should be applied after deduplication with `distinct`\nThis leads to accurate facet counts when using faceting in combination with `distinct`.\nIt's usually better to use `afterDistinct` modifiers in the `attributesForFaceting` setting,\nas `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`.\n", "default": false, "x-categories": [ "Faceting" ] }, "facets": { "type": "array", "items": { "type": "string" }, "description": "Facets for which to retrieve facet values that match the search criteria and the number of matching facet values\nTo retrieve all facets, use the wildcard character `*`.\nTo retrieve disjunctive facets lists, annotate any facets with the `disjunctive` modifier.\nFor 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).\n", "default": [], "x-categories": [ "Faceting" ] }, "feedInjection": { "type": "object", "description": "Feed formatted as an injection.", "additionalProperties": false, "properties": { "injection": { "$ref": "#/$defs/injection" } }, "required": [ "injection" ] }, "filters": { "type": "string", "description": "Filter expression to only include items that match the filter criteria in the response.\n\nYou can use these filter expressions:\n\n- **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`.\n- **Ranges.** `: TO `, where `` and `` are the lower and upper limits of the range (inclusive).\n- **Facet filters.** `:`, where `` is a facet attribute (case-sensitive) and `` a facet value.\n- **Tag filters.** `_tags:` or just `` (case-sensitive).\n- **Boolean filters.** `: true | false`.\n\nYou can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions:\n\n- You can only combine filters of the same type with `OR`.\n **Not supported:** `facet:value OR num > 3`.\n- You can't use `NOT` with combinations of filters.\n **Not supported:** `NOT(facet:value OR facet:value)`\n- You can't combine conjunctions (`AND`) with `OR`.\n **Not supported:** `facet:value OR (facet:value AND facet:value)`\n\nUse quotes if the facet attribute name or facet value contains spaces, keywords (`OR`, `AND`, `NOT`), or quotes.\nIf a facet attribute is an array, the filter matches if it matches at least one element of the array.\n\nFor more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering).\n", "x-categories": [ "Filtering" ] }, "hide": { "description": "Hide facet values.", "type": "array", "items": { "type": "string" } }, "highlightPostTag": { "type": "string", "description": "HTML tag to insert after the highlighted parts in all highlighted results and snippets.", "default": "", "x-categories": [ "Highlighting and Snippeting" ] }, "highlightPreTag": { "type": "string", "description": "HTML tag to insert before the highlighted parts in all highlighted results and snippets.", "default": "", "x-categories": [ "Highlighting and Snippeting" ] }, "hitsPerPage": { "type": "integer", "description": "Number of hits per page.", "default": 20, "minimum": 1, "maximum": 1000, "x-categories": [ "Pagination" ] }, "ignorePlurals": { "description": "Treat singular, plurals, and other forms of declensions as equivalent.\nOnly use this feature for the languages used in your index.\n", "oneOf": [ { "type": "array", "description": "ISO code for languages for which this feature should be active.\nThis overrides languages you set with `queryLanguages`.\n", "items": { "$ref": "#/$defs/supportedLanguage" } }, { "$ref": "#/$defs/booleanString" }, { "type": "boolean", "description": "If true, `ignorePlurals` is active for all languages included in `queryLanguages`, or for all supported languages, if `queryLanguges` is empty.\nIf false, singulars, plurals, and other declensions won't be considered equivalent.\n", "default": false } ], "x-categories": [ "Languages" ] }, "injectedItemExternalSource": { "description": "Injected items will originate from externally provided objectIDs (that must exist in the index) given at runtime in the run request payload.", "x-discriminator-fields": [ "external" ], "type": "object", "additionalProperties": false, "properties": { "external": { "title": "injectedItemExternal", "type": "object", "additionalProperties": false, "properties": { "index": { "type": "string", "description": "Composition Index name." }, "params": { "$ref": "#/$defs/baseInjectionQueryParameters" }, "ordering": { "$ref": "#/$defs/externalOrdering" } }, "required": [ "index" ] } }, "required": [ "external" ] }, "injectedItemRecommendSource": { "description": "Injected items will originate from a recommendation request performed on the specified index.", "x-discriminator-fields": [ "recommend" ], "type": "object", "additionalProperties": false, "properties": { "recommend": { "title": "recommend", "type": "object", "additionalProperties": false, "properties": { "indexName": { "type": "string", "description": "Index to retrieve recommendations from." }, "model": { "$ref": "#/$defs/model" }, "threshold": { "type": "integer", "minimum": 0, "maximum": 100, "description": "Minimum score a recommendation must have to be included." }, "queryParameters": { "$ref": "#/$defs/baseInjectionQueryParameters" }, "fallbackParameters": { "$ref": "#/$defs/baseInjectionQueryParameters" } }, "required": [ "indexName", "model", "threshold" ] } }, "required": [ "recommend" ] }, "injectedItemSearchSource": { "description": "Injected items will originate from a search request performed on the specified index.", "x-discriminator-fields": [ "search" ], "type": "object", "additionalProperties": false, "properties": { "search": { "title": "injectedItemSearch", "type": "object", "additionalProperties": false, "properties": { "index": { "type": "string", "description": "Composition Index name." }, "params": { "$ref": "#/$defs/baseInjectionQueryParameters" } }, "required": [ "index" ] } }, "required": [ "search" ] }, "injectedItemSource": { "oneOf": [ { "$ref": "#/$defs/injectedItemSearchSource" }, { "$ref": "#/$defs/injectedItemExternalSource" }, { "$ref": "#/$defs/injectedItemRecommendSource" } ] }, "injection": { "title": "injection", "type": "object", "additionalProperties": false, "properties": { "main": { "$ref": "#/$defs/injectionMain" }, "injectedItems": { "type": "array", "description": "list of injected items of the current Composition.", "minItems": 0, "maxItems": 3, "items": { "$ref": "#/$defs/injectionInjectedItem" } }, "deduplication": { "title": "deduplication", "type": "object", "additionalProperties": false, "description": "Deduplication configures the methods used to resolve duplicate items between main search results and injected group results.", "properties": { "positioning": { "$ref": "#/$defs/dedupPositioning" } }, "required": [ "positioning" ] } }, "required": [ "main" ] }, "injectionInjectedItem": { "type": "object", "additionalProperties": false, "properties": { "key": { "type": "string", "description": "injected Item unique identifier." }, "source": { "description": "Source to be used to inject items into result set.", "$ref": "#/$defs/injectedItemSource" }, "position": { "type": "integer", "minimum": 0, "maximum": 99 }, "length": { "type": "integer", "minimum": 0, "maximum": 50 }, "metadata": { "title": "injectedItemMetadata", "type": "object", "description": "Used to add metadata to the results of the injectedItem.", "properties": { "hits": { "title": "injectedItemHitsMetadata", "type": "object", "description": "Adds the provided metadata to each injected hit via an `_extra` attribute.", "properties": { "addItemKey": { "type": "boolean", "description": "When true, the `_injectedItemKey` field is set in the `_extra` object of each affected hit." }, "extra": { "type": "object", "additionalProperties": true, "description": "The user-defined key-value pairs that will be placed in the `_extra` field of each affected hit." } } } } } }, "required": [ "key", "source", "position", "length" ] }, "injectionMain": { "type": "object", "additionalProperties": false, "description": "Main defines the organic result set of the injection.", "properties": { "source": { "$ref": "#/$defs/injectionMainSource" } } }, "injectionMainRecommendSource": { "description": "Organic result set will originate from a recommend request.", "x-discriminator-fields": [ "recommend" ], "type": "object", "additionalProperties": false, "properties": { "recommend": { "title": "mainRecommend", "type": "object", "additionalProperties": false, "properties": { "indexName": { "type": "string", "description": "Index to retrieve recommendations from." }, "model": { "$ref": "#/$defs/model" }, "threshold": { "type": "integer", "minimum": 0, "maximum": 100, "description": "Minimum score a recommendation must have to be included." }, "queryParameters": { "$ref": "#/$defs/mainInjectionQueryParameters" }, "fallbackParameters": { "$ref": "#/$defs/mainInjectionQueryParameters" } }, "required": [ "indexName", "model", "threshold" ] } }, "required": [ "recommend" ] }, "injectionMainSearchSource": { "description": "Organic result set will originate from a search request performed on the specified index.", "x-discriminator-fields": [ "search" ], "type": "object", "additionalProperties": false, "properties": { "search": { "title": "mainSearch", "type": "object", "additionalProperties": false, "properties": { "index": { "type": "string", "description": "Index to retrieve search results from." }, "params": { "$ref": "#/$defs/mainInjectionQueryParameters" } }, "required": [ "index" ] } }, "required": [ "search" ] }, "injectionMainSource": { "description": "Source to be used to retrieve organic result set.", "oneOf": [ { "$ref": "#/$defs/injectionMainSearchSource" }, { "$ref": "#/$defs/injectionMainRecommendSource" } ] }, "mainInjectionQueryParameters": { "title": "Composition Main Injection Query parameters as object", "type": "object", "additionalProperties": false, "allOf": [ { "$ref": "#/$defs/baseInjectionQueryParameters" }, { "type": "object", "additionalProperties": false, "properties": { "facetingAfterDistinct": { "$ref": "#/$defs/facetingAfterDistinct" }, "facets": { "$ref": "#/$defs/facets" }, "hitsPerPage": { "$ref": "#/$defs/hitsPerPage" }, "maxValuesPerFacet": { "$ref": "#/$defs/maxValuesPerFacet" }, "renderingContent": { "$ref": "#/$defs/renderingContent" }, "sortFacetValuesBy": { "$ref": "#/$defs/sortFacetValuesBy" }, "sumOrFiltersScores": { "$ref": "#/$defs/sumOrFiltersScores" } } } ] }, "maxValuesPerFacet": { "type": "integer", "description": "Maximum number of facet values to return for each facet.", "default": 100, "maximum": 1000, "x-categories": [ "Faceting" ] }, "minProximity": { "type": "integer", "minimum": 1, "maximum": 7, "description": "Minimum proximity score for two matching words\nThis adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity)\nby equally scoring matches that are farther apart\nFor example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score.\n", "default": 1, "x-categories": [ "Advanced" ] }, "minWordSizefor1Typo": { "type": "integer", "description": "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).", "default": 4, "x-categories": [ "Typos" ] }, "minWordSizefor2Typos": { "type": "integer", "description": "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).", "default": 8, "x-categories": [ "Typos" ] }, "model": { "type": "string", "enum": [ "trending-items" ], "description": "Recommendation model to use for retrieving recommendations." }, "multifeed": { "title": "multifeed", "type": "object", "additionalProperties": false, "properties": { "feeds": { "type": "object", "description": "A key-value store of Feed ID to Feed. Currently, the only supported Feed type is an Injection.", "additionalProperties": { "$ref": "#/$defs/Behaviour_feedID" } }, "feedsOrder": { "type": "array", "description": "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.", "items": { "type": "string" } } }, "required": [ "feeds" ] }, "naturalLanguages": { "type": "array", "items": { "$ref": "#/$defs/supportedLanguage" }, "description": "ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches)\n- Sets `removeStopWords` and `ignorePlurals` to the list of provided languages.\n- Sets `removeWordsIfNoResults` to `allOptional`.\n- Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.\n", "default": [], "x-categories": [ "Languages" ] }, "numericFilters": { "description": "Filter by numeric facets.\n\n**Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.**\n\nYou can use numeric comparison operators: `<`, `<=`, `=`, `!=`, `>`, `>=`.\nComparisons are precise up to 3 decimals.\nYou can also provide ranges: `facet: TO `. The range includes the lower and upper boundaries.\nThe same combination rules apply as for `facetFilters`.\n", "oneOf": [ { "type": "array", "items": { "$ref": "#/$defs/numericFilters" } }, { "type": "string" } ], "x-categories": [ "Filtering" ] }, "optionalFilters": { "description": "Filters to promote or demote records in the search results.\n\nOptional filters work like facet filters, but they don't exclude records from the search results.\nRecords that match the optional filter rank before records that don't match.\nIf you're using a negative filter `facet:-value`, matching records rank after records that don't match.\n\n- Optional filters are applied _after_ sort-by attributes.\n- 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)).\n- Optional filters don't work with numeric attributes.\n- 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).\n", "oneOf": [ { "type": "array", "items": { "$ref": "#/$defs/optionalFilters" } }, { "type": "string" } ], "x-categories": [ "Filtering" ] }, "optionalWords": { "description": "Words that should be considered optional when found in the query.\n\nBy default, records must match all words in the search query to be included in the search results.\nAdding optional words can increase the number of search results by running an additional search query that doesn't include the optional words.\nFor example, if the search query is \"action video\" and \"video\" is optional,\nthe search engine runs two queries: one for \"action video\" and one for \"action\".\nRecords that match all words are ranked higher.\n\nFor a search query with 4 or more words **and** all its words are optional,\nthe number of matched words required for a record to be included in the search results increases for every 1,000 records:\n\n- If `optionalWords` has fewer than 10 words, the required number of matched words increases by 1:\n results 1 to 1,000 require 1 matched word; results 1,001 to 2,000 need 2 matched words.\n- 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).\n Example: with 18 optional words, results 1 to 1,000 require 1 matched word; results 1,001 to 2,000 need 4 matched words.\n\nFor 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).\n", "oneOf": [ { "type": "string" }, { "type": "null" }, { "$ref": "#/$defs/optionalWordsArray" } ] }, "optionalWordsArray": { "type": "array", "items": { "type": "string" }, "description": "List of [optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).", "default": [], "x-categories": [ "Query strategy" ] }, "order": { "description": "Explicit order of facets or facet values.\n\nThis setting lets you always show specific facets or facet values at the top of the list.\n", "type": "array", "items": { "type": "string" } }, "percentileComputation": { "type": "boolean", "description": "Whether to include this search when calculating processing-time percentiles.", "default": true, "x-categories": [ "Advanced" ] }, "personalizationImpact": { "type": "integer", "description": "Impact that Personalization should have on this search\nThe higher this value is, the more Personalization determines the ranking compared to other factors.\nFor more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).\n", "default": 100, "minimum": 0, "maximum": 100, "x-categories": [ "Personalization" ] }, "queryLanguages": { "type": "array", "items": { "$ref": "#/$defs/supportedLanguage" }, "description": "Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries.\nThis setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings.\nThis 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.\nTo support this, place the CJK language **first**.\n**Always specify a query language.**\nIf 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),\nor the languages you specified with the `ignorePlurals` or `removeStopWords` parameters.\nThis can lead to unexpected search results.\nFor 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).\n", "default": [], "x-categories": [ "Languages" ] }, "queryType": { "type": "string", "enum": [ "prefixLast", "prefixAll", "prefixNone" ], "description": "Determines if and how query words are interpreted as prefixes.\n\nBy default, only the last query word is treated as a prefix (`prefixLast`).\nTo turn off prefix search, use `prefixNone`.\nAvoid `prefixAll`, which treats all query words as prefixes.\nThis might lead to counterintuitive results and makes your search slower.\n\nFor more information, see [Prefix searching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching).\n", "default": "prefixLast", "x-categories": [ "Query strategy" ] }, "redirectURL": { "description": "The redirect rule container.", "type": "object", "additionalProperties": false, "properties": { "url": { "type": "string" } } }, "removeStopWords": { "description": "Removes stop words from the search query.\n\nStop words are common words like articles, conjunctions, prepositions, or pronouns that have little or no meaning on their own.\nIn English, \"the\", \"a\", or \"and\" are stop words.\n\nOnly use this feature for the languages used in your index.\n", "oneOf": [ { "type": "array", "description": "ISO code for languages for which stop words should be removed. This overrides languages you set in `queryLanguges`.", "items": { "$ref": "#/$defs/supportedLanguage" } }, { "type": "boolean", "default": false, "description": "If true, stop words are removed for all languages you included in `queryLanguages`, or for all supported languages, if `queryLanguages` is empty.\nIf false, stop words are not removed.\n" } ], "x-categories": [ "Languages" ] }, "removeWordsIfNoResults": { "type": "string", "enum": [ "none", "lastWords", "firstWords", "allOptional" ], "description": "Strategy for removing words from the query when it doesn't return any results.\nThis helps to avoid returning empty search results.\n\n- `none`.\n No words are removed when a query doesn't return results.\n\n- `lastWords`.\n Treat the last (then second to last, then third to last) word as optional,\n until there are results or at most 5 words have been removed.\n\n- `firstWords`.\n Treat the first (then second, then third) word as optional,\n until there are results or at most 5 words have been removed.\n\n- `allOptional`.\n Treat all words as optional.\n\nFor 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).\n", "default": "none", "x-categories": [ "Query strategy" ] }, "renderingContent": { "description": "Extra data that can be used in the search UI.\n\nYou can use this to control aspects of your search UI, such as the order of facet names and values\nwithout changing your frontend code.\n", "type": "object", "additionalProperties": false, "properties": { "facetOrdering": { "$ref": "#/$defs/facetOrdering" }, "redirect": { "$ref": "#/$defs/redirectURL" }, "widgets": { "$ref": "#/$defs/widgets" } }, "x-categories": [ "Advanced" ] }, "replaceSynonymsInHighlight": { "type": "boolean", "description": "Whether to replace a highlighted word with the matched synonym\nBy default, the original words are highlighted even if a synonym matches.\nFor example, with `home` as a synonym for `house` and a search for `home`,\nrecords matching either \"home\" or \"house\" are included in the search results,\nand either \"home\" or \"house\" are highlighted\nWith `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records,\nbut all occurrences of \"house\" are replaced by \"home\" in the highlighted response.\n", "default": false, "x-categories": [ "Highlighting and Snippeting" ] }, "responseFields": { "type": "array", "items": { "type": "string" }, "description": "Properties to include in the API response of search and browse requests\nBy default, all response properties are included.\nTo reduce the response size, you can select which properties should be included\nAn empty list may lead to an empty API response (except properties you can't exclude)\nYou can't exclude these properties:\n`message`, `warning`, `cursor`, `abTestVariantID`,\nor any property added by setting `getRankingInfo` to true\nYour search depends on the `hits` field. If you omit this field, searches won't return any results.\nYour UI might also depend on other properties, for example, for pagination.\nBefore restricting the response size, check the impact on your search experience.\n", "default": [ "*" ], "x-categories": [ "Advanced" ] }, "restrictHighlightAndSnippetArrays": { "type": "boolean", "description": "Whether to restrict highlighting and snippeting to items that at least partially matched the search query.\nBy default, all items are highlighted and snippeted.\n", "default": false, "x-categories": [ "Highlighting and Snippeting" ] }, "restrictSearchableAttributes": { "type": "array", "items": { "type": "string" }, "description": "Restricts a search to a subset of your searchable attributes.\nAttribute names are case-sensitive.\n", "default": [], "x-categories": [ "Filtering" ] }, "snippetEllipsisText": { "type": "string", "description": "String used as an ellipsis indicator when a snippet is truncated.", "default": "…", "x-categories": [ "Highlighting and Snippeting" ] }, "sortFacetValuesBy": { "type": "string", "description": "Order in which to retrieve facet values\n- `count`.\n Facet values are retrieved by decreasing count.\n The count is the number of matching records containing this facet value\n- `alpha`.\n Retrieve facet values alphabetically\nThis setting doesn't influence how facet values are displayed in your UI (see `renderingContent`).\nFor more information, see [facet value display](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/facet-display/js).\n", "default": "count", "x-categories": [ "Faceting" ] }, "sortRemainingBy": { "description": "Order of facet values that aren't explicitly positioned with the `order` setting.\n\n- `count`.\n Order remaining facet values by decreasing count.\n The count is the number of matching records containing this facet value.\n\n- `alpha`.\n Sort facet values alphabetically.\n\n- `hidden`.\n Don't show facet values that aren't explicitly positioned.\n", "type": "string", "enum": [ "count", "alpha", "hidden" ] }, "sumOrFiltersScores": { "type": "boolean", "description": "Whether to sum all filter scores\nIf true, all filter scores are summed.\nOtherwise, the maximum filter score is kept.\nFor more information, see [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores).\n", "default": false, "x-categories": [ "Filtering" ] }, "supportedLanguage": { "type": "string", "description": "ISO code for a supported language.", "enum": [ "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" ] }, "synonyms": { "type": "boolean", "description": "Whether to take into account an index's synonyms for this search.", "default": true, "x-categories": [ "Advanced" ] }, "timeRange": { "type": "object", "additionalProperties": false, "properties": { "from": { "type": "integer", "format": "int64", "description": "Timestamp when the rule should start to be active, measured in seconds since the Unix epoch." }, "until": { "type": "integer", "format": "int64", "description": "Timestamp when the rule should stop to be active, measured in seconds since the Unix epoch." } } }, "typoTolerance": { "description": "Whether [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance) is enabled and how it is applied.\n\nIf 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.\n", "oneOf": [ { "type": "boolean", "default": true, "description": "Whether typo tolerance is active. If true, matches with typos are included in the search results and rank after exact matches." }, { "$ref": "#/$defs/typoToleranceEnum" } ], "x-categories": [ "Typos" ] }, "typoToleranceEnum": { "type": "string", "title": "typo tolerance", "description": "- `min`. Return matches with the lowest number of typos.\n For example, if you have matches without typos, only include those.\n But if there are no matches without typos (with 1 typo), include matches with 1 typo (2 typos).\n- `strict`. Return matches with the two lowest numbers of typos.\n With `strict`, the Typo ranking criterion is applied first in the `ranking` setting.\n", "enum": [ "min", "strict", "true", "false" ] }, "value": { "type": "object", "additionalProperties": false, "properties": { "order": { "$ref": "#/$defs/order" }, "sortRemainingBy": { "$ref": "#/$defs/sortRemainingBy" }, "hide": { "$ref": "#/$defs/hide" } } }, "values": { "description": "Order of facet values. One object for each facet.", "type": "object", "additionalProperties": { "x-additionalPropertiesName": "facet", "$ref": "#/$defs/value" } }, "widgets": { "description": "Widgets returned from any rules that are applied to the current search.", "type": "object", "additionalProperties": false, "properties": { "banners": { "$ref": "#/$defs/banners" } } } } }