Skip to main content

facets

Facets​

The facets function calculates facets for a specific attribute of a model. A facet is filter that helps you narrow down your search in an online catalog or store. Imagine you're looking for a book or a product, and there are too many options. Facets let you choose specific categories or features—like price, color, brand, or genre—to quickly find what you're looking for.

For example, if you're on a website looking for a red shirt, you can use a color facet to only see red shirts, or a size facet to find only shirts in your size. It makes searching faster and easier by letting you focus on exactly what you want.

Per default dcupl calculates in advance what products are left over when you apply those facets via a filter.

const colorFacets = dcupl.fn.facets({
modelKey: 'Style',
options: {
attribute: 'baseColour',
},
});
info

Try it out yourself in the Playground