Shape Category Data so the Console Draws a Tree
A catalogue has a hierarchy, and the Indx server's console draws it: the dataset's Categories tab shows every category as a node with its product count, the subcategories fanned out to the right, the chosen category with its first products beside it and a step to boost it. Nothing is configured for this beyond the field roles; the tree is read from the data as it is. Two shapes are recognised.
A path in one field
One value per product with the levels in it, the way a Google product feed writes product_type
and google_product_category:
{ "sku": "SKU-100042", "name": "Oak Chair", "product_type": "Furniture > Chairs > Office chairs" }The separator is detected from the values, " > " first, then /, |, > and -; an editor can
choose it on the tab when the values are unusual. A product in several categories is an array of
paths, and counts in each. A field whose values only sometimes carry a separator, such as a colour
of "Gold/black", is not taken for a hierarchy: six in ten values must have it.
A level per field
Fields that share a prefix and each hold one level, as a nested object does:
{ "sku": "SKU-100042", "category": { "department": "Furniture", "section": "Chairs", "type": "Office chairs" } }Two or more such fields marked facetable make a group, offered on the tab as category: department › section › type. A product with only the department is filed at the department.
The roles to set
- Facetable on the path field, or on every field of the group: the tab finds its sources among the facetable fields, and reads the tree from the facet histogram, so a flat field costs it nothing.
- Filterable too, and the chosen category lists its products, and Boost this category opens the Boost rules tab with a rule drafted: one value condition on the path field, or one per level of the group.
Over the API the same histogram is an empty search with enableFacets: true: every path with its
count, from which a storefront draws its own menu. See Perform an Empty Search with Sorting and
Facets.
What the tree is not
It lists categories, never products: a category's products come twenty at a time in its panel. A field with more than 2,000 distinct paths is declined with a note, since a category tree has hundreds and a field with thousands is a name or a code. Paths are cut at eight levels and names at sixty characters.