{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-suggestion-result-schema.json",
  "title": "SuggestionResult",
  "description": "Document representing a search suggestion result.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-shopper-search-api-openapi.yml#/components/schemas/SuggestionResult",
  "properties": {
    "brandSuggestions": {
      "description": "Returns the suggested brands.",
      "allOf": [
        {
          "$ref": "#/$defs/BrandSuggestions"
        }
      ]
    },
    "categorySuggestions": {
      "description": "Returns the suggested categories.",
      "allOf": [
        {
          "$ref": "#/$defs/CategorySuggestions"
        }
      ]
    },
    "productSuggestions": {
      "description": "Returns the suggested products.",
      "allOf": [
        {
          "$ref": "#/$defs/ProductSuggestions"
        }
      ]
    },
    "customSuggestion": {
      "description": "Returns custom suggestions.",
      "allOf": [
        {
          "$ref": "#/$defs/CustomSuggestions"
        }
      ]
    },
    "einsteinSuggestedPhrases": {
      "description": "Returns Einstein suggested phrases containing popular and recent search phrases.",
      "allOf": [
        {
          "$ref": "#/$defs/EinsteinSuggestedPhrases"
        }
      ]
    },
    "searchPhrase": {
      "description": "The query phrase (q) for which suggestions where made.",
      "type": "string",
      "minLength": 3,
      "maxLength": 50
    },
    "searchMode": {
      "description": "The search matching approach the client requested for these suggestions, echoed back from the `searchMode` query parameter. Omitted when the request did not supply one. This is the requested hint, not necessarily the mode that served the suggestions — see `effectiveSearchMode`.",
      "allOf": [
        {
          "$ref": "#/$defs/SearchMode"
        }
      ]
    },
    "effectiveSearchMode": {
      "description": "The search matching approach the platform actually used to serve these suggestions. May differ from the requested `searchMode` when the platform demoted the mode (for example when the semantic index is unavailable).",
      "allOf": [
        {
          "$ref": "#/$defs/SearchMode"
        }
      ]
    }
  },
  "required": [
    "searchPhrase"
  ],
  "type": "object",
  "$defs": {
    "BrandSuggestions": {
      "description": "The suggested brand names are listed in suggested phrases. If this list is empty, no brand suggestion for a given search phrase was found.",
      "allOf": [
        {
          "$ref": "#/$defs/Suggestion"
        }
      ]
    },
    "CategorySuggestions": {
      "allOf": [
        {
          "$ref": "#/$defs/Suggestion"
        }
      ],
      "properties": {
        "categories": {
          "description": "The sorted list of suggested categories. This list can be empty.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SuggestedCategory"
          }
        }
      },
      "type": "object"
    },
    "CurrencyCode": {
      "description": "A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.",
      "pattern": "^([A-Z][A-Z][A-Z]|N/A)$",
      "type": "string"
    },
    "CustomSuggestions": {
      "description": "The custom suggestions are listed in suggested phrases. If this list is empty, no custom suggestion for the given search phrase was found.",
      "allOf": [
        {
          "$ref": "#/$defs/Suggestion"
        }
      ],
      "properties": {
        "customSuggestion": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "EinsteinSuggestedPhrases": {
      "description": "Einstein-suggested phrases containing popular and recent search phrases.",
      "properties": {
        "popularSearchPhrases": {
          "description": "A list of popular search phrases suggested by Einstein. This list can be empty.",
          "type": "array",
          "maxLength": 10,
          "items": {
            "$ref": "#/$defs/SuggestedPhrase"
          }
        },
        "recentSearchPhrases": {
          "description": "A list of recent search phrases suggested by Einstein. This list can be empty.",
          "type": "array",
          "maxLength": 10,
          "items": {
            "$ref": "#/$defs/SuggestedPhrase"
          }
        }
      },
      "type": "object"
    },
    "ProductSuggestions": {
      "allOf": [
        {
          "$ref": "#/$defs/Suggestion"
        }
      ],
      "properties": {
        "products": {
          "description": "The sorted list of suggested products. This list can be empty.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SuggestedProduct"
          }
        }
      },
      "type": "object"
    },
    "SearchMode": {
      "description": "A search matching approach. `semantic` is meaning-based matching; `lexical` is keyword/token-based matching.",
      "type": "string",
      "enum": [
        "semantic",
        "lexical"
      ]
    },
    "SuggestedCategory": {
      "properties": {
        "id": {
          "description": "The ID of the category.",
          "type": "string",
          "minLength": 1,
          "maxLength": 260
        },
        "name": {
          "description": "The localized name of the category.",
          "minLength": 1,
          "type": "string",
          "maxLength": 4000
        },
        "parentCategoryName": {
          "description": "The name of the parent category.",
          "minLength": 1,
          "type": "string",
          "maxLength": 4000
        }
      },
      "required": [
        "id",
        "name",
        "parentCategoryName"
      ],
      "type": "object",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      }
    },
    "SuggestedPhrase": {
      "description": "Document representing a suggested search phrase.",
      "properties": {
        "exactMatch": {
          "description": "Returns whether this suggested phrase exactly matches the user input search phrase.",
          "type": "boolean",
          "minLength": 1
        },
        "phrase": {
          "description": "Returns the suggested search phrase.",
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        }
      },
      "required": [
        "exactMatch",
        "phrase"
      ],
      "type": "object",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      }
    },
    "SuggestedProduct": {
      "description": "Document representing a product search hit.",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "price": {
          "format": "double",
          "description": "The sales price of the product. In the case of complex products like a master or a set, this is the minimum price of\n related child products.",
          "type": "number",
          "minLength": 1
        },
        "productId": {
          "description": "The ID (SKU) of the product.",
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "productName": {
          "description": "The localized name of the product.",
          "minLength": 1,
          "type": "string",
          "maxLength": 4000
        },
        "slug": {
          "description": "SEO-friendly slug for the product, derived from the site's configured product URL rule.\nThis is the slug segment only, not a full URL. Returned only when `expand=slug` is requested.\nUse the slug to construct user-friendly product detail page URLs (for example,\n/products/{slug}/{productId}).",
          "type": "string",
          "maxLength": 4000
        }
      },
      "required": [
        "currency",
        "price",
        "productId",
        "productName"
      ],
      "type": "object",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      }
    },
    "SuggestedTerm": {
      "description": "Document representing a suggested term.",
      "properties": {
        "completed": {
          "description": "Returns whether this term value is a completion match.",
          "type": "boolean",
          "minLength": 1
        },
        "corrected": {
          "description": "Returns whether this term value is a correction match.",
          "type": "boolean",
          "minLength": 1
        },
        "exactMatch": {
          "description": "Returns whether this term value is a exact match.",
          "type": "boolean",
          "minLength": 1
        },
        "value": {
          "description": "Returns the term value.",
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        }
      },
      "required": [
        "completed",
        "corrected",
        "exactMatch",
        "value"
      ],
      "type": "object"
    },
    "SuggestedTerms": {
      "description": "Document representing a list of suggested terms for each term of a search phrase.",
      "properties": {
        "originalTerm": {
          "description": "Returns the original term that the suggested terms relates to.",
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "terms": {
          "description": "Returns the suggested terms.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SuggestedTerm"
          }
        }
      },
      "required": [
        "originalTerm"
      ],
      "type": "object"
    },
    "Suggestion": {
      "description": "Document representing a suggestion.",
      "properties": {
        "suggestedPhrases": {
          "description": "A list of suggested phrases. This list can be empty.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SuggestedPhrase"
          }
        },
        "suggestedTerms": {
          "description": "A list of suggested terms. This list can be empty.",
          "type": "array",
          "minLength": 1,
          "items": {
            "$ref": "#/$defs/SuggestedTerms"
          }
        }
      },
      "required": [
        "suggestedTerms"
      ],
      "type": "object",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      }
    }
  }
}