productSearch
Search for products with advanced filtering, sorting, and pagination capabilities
Arguments
| Argument | Type | Description |
|---|---|---|
categoryId | String | |
page | Int! | Default 1 |
pageSize | Int! | Default 20 |
searchTerm | String | |
sort | ProductSortOrderType! | |
filters | [FacetFilterInput!] | Default [] |
prefilters | [FilterConditionInput!] | Default [] |
exactSearchTerm | Boolean | Search searchTerm as typed, without correcting its spelling, for the
shopper who asks for exactly that.Default false |
Returns
| Field | Type | Description |
|---|---|---|
items | [Product!]! | List of products in the result |
pagination | Pagination! | Where this page sits within the full result set |
facets | [Facet!] | Available facets for filtering |
queryId | String | The search engine's id for this search, for click and conversion analytics that attribute an event to the search it came from. Null where the engine issues none, or analytics is not enabled for it. |
correctedSearchTerm | String | The term the products were found for, where the term as typed found nothing and the engine's top suggestion did. Null when the term was searched as given, and always null with exactSearchTerm. |
redirect | SearchRedirect | Where one of the engine's keyword rules sends this search term instead of to a result page. Null where the engine has no matching rule. |
Example
query { productSearch( searchTerm: "laptop" categoryId: "cat-electronics" page: 1 pageSize: 24 sort: PRICE_ASCENDING filters: [ { key: "price", min: 500, max: 2000 }, { key: "brand", selections: ["Apple", "Dell"] } ] ) { pagination { totalCount hasNextPage } items { id slug name variant { id sku price { gross { centAmount currency } } } } facets { ... on RangeFacet { key label min max } ... on OptionsFacet { key label options { key label count } } } }}{ "data": { "productSearch": { "pagination": { "totalCount": 1, "hasNextPage": true }, "items": [ { "id": "id-1", "slug": "/example", "name": "Example", "variant": { "id": "id-1", "sku": "SKU-1", "price": { "gross": { "centAmount": 1, "currency": "EUR" } } } } ], "facets": [ { "key": "Example", "label": "Example", "min": 9.95, "max": 9.95 } ] } }}The query is the example the schema documents. The response shows its shape with placeholder values.
Served by
| @evolve-framework/commercetools | Resolved |
| @evolve-framework/medusa | Resolved |
| @evolve-framework/sfcc | Resolved |
Used by
The storefront packages that send it, in these GraphQL documents:
- @evolve-storefront/feature-cart:
GetQuickAddSuggestions - @evolve-storefront/feature-product:
ProductListingProducts,ProductListingCount,ProductListingFacets,ProductSearchAssist

