Skip to main content

Facet Stat

Add toTextDiv / container

Role attribute

Every instance of this component carries:

Add this attribute
Namewf-algolia-element
Valuefacet-stat
Required2 attributes
IndexRequired

Algolia index to query.

StatRequired

Which value to display: an aggregate (min/max/avg/sum) of wf-algolia-field, or count (number of matching records - needs no field).

Accepts min · max · avg · sum · countDefault minNeeds script 1.0.2

Optional10 attributes
Field

Numeric field to aggregate for min/max/avg/sum (must be numeric + in attributesForFaceting, e.g. rate). Not needed when wf-algolia-stat="count".

Format

Optional number/date transform: number (thousands grouping), year (4-digit), or rating (★). Independent of prefix/suffix - those now render via the display template.

Accepts number · year · rating

Prefix

Text shown before the value (e.g. a currency symbol or unit). Rendered by composing it into the display template as "<prefix>{value}", so it applies with or without a number format. Example: "$" shows 1299 as $1299.

Accepts e.g. $

Suffix

Text shown after the value (e.g. a unit or symbol). Rendered by composing it into the display template as "{value}<suffix>", so it applies with or without a number format. Example: " kg" shows 5 as 5 kg.

Accepts e.g. kg

Decimals

How many decimal places to keep on a number. Example: "2" keeps cents, so 1299 shows as 1299.00. Leave blank for whole numbers.

Accepts min 0, max 10, whole numbers

Display template

Advanced: full display template with {value}, e.g. "From {value}". If set, it overrides Prefix/Suffix (they are ignored).

Accepts e.g. Showing {shown} of {total}

Base filter field

Static field to scope the stat (with -value), e.g. categories.lvl0.

Accepts e.g. categories.lvl0Needs script 1.0.2Repeatable as -2, -3, …

Base filter value

Scope value (CMS-bindable), e.g. the category name.

Accepts e.g. Creative & BrandNeeds script 1.0.2Repeatable as -2, -3, …

Link template

Make the tile navigable. URL template with {value} (the scoped base-filter value) and {field}, e.g. /category/{value}.

Accepts e.g. /category/{value}

Slugify

Cleans the value into a URL-friendly slug before it goes into the link. Example: "Creative & Brand" becomes creative-brand. Off by default.

Accepts true · falseDefault false