Skip to content

SearchProduct

Type: schema

Description

Payload for searching products.

TypeScript Definition

typescript
SearchProduct: {{
            /** @description String for searching products, considers the first ten words of any given search query. */
            query: string;
            /**
             * @description To request a specific page of results.
             * @default 1
             */
            page: number;
            /**
             * @description Maximum number of records returned for a page.
             * @default 25
             */
            limit: number;
            /** @description provide list of attributes for specific facets or * for all facets. All attributes supported in the filter parameter are also supported here. */
            facets?: string[];
            /**
             * @description Filter expression(s) to narrow results. Omit for no filtering.
             *
             *     **Syntax:** `attribute OPERATOR value`
             *
             *     **Operators:**
             *
             *     | Operator | Description | Example |
             *     |---|---|---|
             *     | `=` | Equal to | `product_type = physical` |
             *     | `!=` | Not equal to | `product_type != bundle` |
             *     | `>`, `>=`, `<`, `<=` | Comparison | `rating > 4` |
             *     | `TO` | Inclusive range (`>=` AND `<=`) | `pricing.selling_price 100 TO 500` |
             *     | `IN [...]` | Matches any value in the list | `product_type IN [physical,bundle]` |
             *     | `NOT IN [...]` | Excludes all values in the list | `product_type NOT IN [physical,bundle]` |
             *     | `EXISTS` | Attribute is present (even if `null` or empty) | `tags EXISTS` |
             *     | `NOT EXISTS` | Attribute is absent | `tags NOT EXISTS` |
             *     | `IS NULL` | Value is `null` | `variant_id IS NULL` |
             *     | `IS NOT NULL` | Value is not `null` | `variant_id IS NOT NULL` |
             *     | `IS EMPTY` | Value is `""`, `[]`, or `{}` | `tags IS EMPTY` |
             *     | `IS NOT EMPTY` | Value is not empty | `tags IS NOT EMPTY` |
             *     | `AND` | Both conditions must match | `rating > 4 AND product_type = physical` |
             *     | `OR` | Either condition must match | `product_type = physical OR product_type = bundle` |
             *     | `NOT` | Negates a condition | `NOT product_type = bundle` |
             *
             *     **Important rules:**
             *     - Operators are **case-sensitive** — must be uppercase (`AND`, not `and`).
             *     - String value comparison is **case-insensitive** — `product_type = Physical` matches `physical`.
             *     - Operator precedence: `NOT` > `AND` > `OR`. Use parentheses to override.
             *     - String values containing whitespace must be wrapped in single quotes.
             *     - `IN` takes comma-separated values in square brackets.
             *     - Maximum array nesting depth is **2 levels**.
             *
             *     **Supported attributes:** `product_type`, `categories.name`, `attributes.key`, `pricing.listing_price`, `pricing.selling_price`, `pricing.tax_rate`, `product_id`, `variant_id`, `product_name`, `variant_name`, `tags`, `sku`, `stock_available`, `rating`
             *
             *     **Combining conditions:**
             *     - **String:** Use `AND`/`OR` operators inline — `"rating > 4 AND product_type = physical"`
             *     - **Array of strings:** Conditions are combined with AND — `["rating > 4", "product_type = physical"]`
             *     - **Nested arrays:** Inner arrays express OR, outer array expresses AND — `["product_type = physical", ["product_type = bundle", "rating > 4"]]`
             */
            filter?: string | (string | string[])[];
            /**
             * @description Sort results by attributes. Use `asc` for ascending order and `desc` for descending order.
             * @example product_type:desc
             * @example product_name:asc
             */
            sort?: string[];
        };
        /** SellerDetail */
}

OpenAPI Schema

json
{
  "title": "SearchProduct",
  "description": "Payload for searching products.",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/SearchProduct",
    "description": "API reference for the SearchProduct schema"
  },
  "required": [
    "query"
  ],
  "properties": {
    "query": {
      "description": "String for searching products, considers the first ten words of any given search query.",
      "type": "string"
    },
    "page": {
      "description": "To request a specific page of results.",
      "type": "integer",
      "default": 1
    },
    "limit": {
      "description": "Maximum number of records returned for a page.",
      "type": "integer",
      "default": 25
    },
    "facets": {
      "description": "provide list of attributes for specific facets or * for all facets. All attributes supported in the filter parameter are also supported here.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "filter": {
      "description": "Filter expression(s) to narrow results. Omit for no filtering.\n\n**Syntax:** `attribute OPERATOR value`\n\n**Operators:**\n\n| Operator | Description | Example |\n|---|---|---|\n| `=` | Equal to | `product_type = physical` |\n| `!=` | Not equal to | `product_type != bundle` |\n| `>`, `>=`, `<`, `<=` | Comparison | `rating > 4` |\n| `TO` | Inclusive range (`>=` AND `<=`) | `pricing.selling_price 100 TO 500` |\n| `IN [...]` | Matches any value in the list | `product_type IN [physical,bundle]` |\n| `NOT IN [...]` | Excludes all values in the list | `product_type NOT IN [physical,bundle]` |\n| `EXISTS` | Attribute is present (even if `null` or empty) | `tags EXISTS` |\n| `NOT EXISTS` | Attribute is absent | `tags NOT EXISTS` |\n| `IS NULL` | Value is `null` | `variant_id IS NULL` |\n| `IS NOT NULL` | Value is not `null` | `variant_id IS NOT NULL` |\n| `IS EMPTY` | Value is `\"\"`, `[]`, or `{}` | `tags IS EMPTY` |\n| `IS NOT EMPTY` | Value is not empty | `tags IS NOT EMPTY` |\n| `AND` | Both conditions must match | `rating > 4 AND product_type = physical` |\n| `OR` | Either condition must match | `product_type = physical OR product_type = bundle` |\n| `NOT` | Negates a condition | `NOT product_type = bundle` |\n\n**Important rules:**\n- Operators are **case-sensitive** — must be uppercase (`AND`, not `and`).\n- String value comparison is **case-insensitive** — `product_type = Physical` matches `physical`.\n- Operator precedence: `NOT` > `AND` > `OR`. Use parentheses to override.\n- String values containing whitespace must be wrapped in single quotes.\n- `IN` takes comma-separated values in square brackets.\n- Maximum array nesting depth is **2 levels**.\n\n**Supported attributes:** `product_type`, `categories.name`, `attributes.key`, `pricing.listing_price`, `pricing.selling_price`, `pricing.tax_rate`, `product_id`, `variant_id`, `product_name`, `variant_name`, `tags`, `sku`, `stock_available`, `rating`\n\n**Combining conditions:**\n- **String:** Use `AND`/`OR` operators inline — `\"rating > 4 AND product_type = physical\"`\n- **Array of strings:** Conditions are combined with AND — `[\"rating > 4\", \"product_type = physical\"]`\n- **Nested arrays:** Inner arrays express OR, outer array expresses AND — `[\"product_type = physical\", [\"product_type = bundle\", \"rating > 4\"]]`",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        }
      ]
    },
    "sort": {
      "description": "Sort results by attributes. Use `asc` for ascending order and `desc` for descending order.",
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        "product_type:desc",
        "product_name:asc"
      ]
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: