Defining Category Facets in a List or Search Result Page

When enabled, the Wrapper uses the category_facet SPARQUE Desk endpoint to determine which category options are available whenever the Wrapper endpoints search or products are requested. This endpoint outputs the entire category tree, and the application can specify which levels to display.

To enable or disable category facets, please refer to Settings Through SPARQUE Hub | Category Facets. Alternatively, you can define category facets like any other fixed facet with the name “category”.

API Endpoints

Endpoint category_facets

This endpoint outputs all categories derived from the available products. For example, you can use a strategy like the one shown below. Make sure to adjust the depth (Maximum number of steps) of the second Traverse relation block to include the full category tree.


SPARQUE Desk strategy

SPARQUE Desk endpoint example:

OBJ -> category_facets -> OBJ

Update the result description to include all subcategories. Specifically, define as many nested levels of the category object as required to match the depth of your category tree.

Example API result description (excerpt):

   {
      "class": "https://www.sparque.ai/category",
      "level": 2,
      "mode": "full",
      "attributes": [
         {
            "name": "description",
            "type": "STRING",
            "aggr": "most_frequent"
         },
         {
            "name": "identifier",
            "type": "STRING",
            "aggr": "most_frequent",
            "splitLanguages": true
         },
         {
            "name": "image",
            "type": "STRING",
            "aggr": "most_frequent",
            "splitLanguages": true
         },
         {
            "name": "name",
            "type": "STRING",
            "aggr": "most_frequent"
         },
         {
            "name": "online",
            "type": "INTEGER",
            "aggr": "most_frequent"
         },
         {
            "name": "root",
            "type": "INTEGER",
            "aggr": "most_frequent"
         }
      ],
      "constants": [],
      "includes": [
         {
            "class": [
               "https://www.sparque.ai/category"
            ],
            "cardinality": "*",
            "level": 3,
            "prefix": "hasParent",
            "dense": false,
            "predicate": "hasParent",
            "reverse": false
         }
      ]
   },
   [...]

Endpoint category:FILTER

The category:FILTER endpoint outputs all products after one or more categories have been applied as facets. This endpoint requires a /value/ as a parameter (tuple list). The input is all products from a search or lister page.

OBJ -> category:FILTER/p/value/{TUPLE_LIST} -> OBJ