Search products with faceted filters
Run a product search with attribute-based filters and return available facets for the UI.
Step 1 — Fetch available filter facets
First, query the available filters for a category or search result. These facets drive your filter UI.
query {
products(input: {
categoryId: 1795
}) {
itemsFound
filters(input: { isPublic: true }) {
id
searchId
description { language value }
type
enumValues
intValues { min max }
decimalValues { min max }
}
}
}
{
"data": {
"products": {
"itemsFound": 42,
"filters": [
{
"id": "a1b2c3d4",
"searchId": "BRAND",
"description": [{ "language": "NL", "value": "Merk" }],
"type": "ENUM",
"enumValues": ["HP", "Lenovo", "Dell"],
"intValues": null,
"decimalValues": null
},
{
"id": "e5f6g7h8",
"searchId": "WEIGHT_KG",
"description": [{ "language": "NL", "value": "Gewicht" }],
"type": "DECIMAL",
"enumValues": null,
"intValues": null,
"decimalValues": { "min": 1.2, "max": 3.8 }
}
]
}
}
}
Use searchId as the name parameter in textFilters or rangeFilters. Only attributes with isSearchable: true appear as filters.
Step 2 — Apply text filters
Filter by attribute values like brand or material. Multiple values within a single filter use OR logic. Multiple filters use AND logic.
query {
products(input: {
categoryId: 1795
textFilters: [
{ name: "BRAND", values: ["HP", "Lenovo"] }
]
}) {
itemsFound
items {
... on Product {
productId
names { language value }
manufacturer
}
}
}
}
{
"data": {
"products": {
"itemsFound": 12,
"items": [
{
"productId": 1895,
"names": [{ "language": "NL", "value": "HP ProBook 450 G10 i5" }],
"manufacturer": "HP"
}
]
}
}
}
Step 3 — Apply range filters
Filter by numeric attributes within a min/max range. Works on INT and DECIMAL type attributes.
query {
products(input: {
categoryId: 1795
textFilters: [
{ name: "BRAND", values: ["HP"] }
]
rangeFilters: [
{ name: "WEIGHT_KG", min: 1.0, max: 2.5 }
]
}) {
itemsFound
items {
... on Product {
productId
names { language value }
}
}
}
}
Step 4 — Apply price range filter
Filter products within a price range. The response includes minPrice and maxPrice across the result set, useful for rendering price sliders.
query {
products(input: {
categoryId: 1795
price: { min: 500, max: 1500 }
}) {
itemsFound
minPrice
maxPrice
items {
... on Product {
productId
names { language value }
price(input: { quantity: 1, taxZone: "NL" }) {
gross
net
}
}
}
}
}
{
"data": {
"products": {
"itemsFound": 15,
"minPrice": 520,
"maxPrice": 1499,
"items": [
{
"productId": 1895,
"names": [{ "language": "NL", "value": "HP ProBook 450 G10 i5" }],
"price": { "gross": 899, "net": 1087.79 }
}
]
}
}
}
How it works
textFiltersmatch against product attribute values. Thenamemust match an existingAttributeDescriptionname in your system.rangeFilterswork on numeric attributes like weight, length or wattage.pricefilters on the calculated product price.- All filter types combine with AND logic — products must match every filter.
- Facets in the response reflect the current result set, so they update as filters are applied.