Faceting

Sooqr supports the use of facets. Facets are based on the configured filters in mySooqr. By default, facets are disabled in the Search API. You have to specify the facet=1 option in the API URL to enable them.

Response example

Please note that the items tag has been cleared for this example.

{
   "items":[ ... ],
   "metaData":{
      "numFound":6,
      "maxScore":1.239027,
      "queryTime":9,
      "start":0,
      "rows":10
   },
   "spellcheck":false,
   "facets":{
      "brand":{
         "current":[],
         "all":[]
      },
      "subcategory":{
         "current":{
            "Tees, Knits and Polos":6,
            "New Arrivals":1,
            "New ArrivalsTees, Knits and Polos":1
         },
         "all":{
            "Tees, Knits and Polos":6,
            "New Arrivals":1,
            "New ArrivalsTees, Knits and Polos":1
         }
      }
   }
}

Facet structure

Each facet contains two subnodes: current and all. Without additional filtering, both nodes contain the same data. But when a filter is added to the search query, the all node will show the number of results as if the filter wasn't set. This can be valuable information if your search interface should show all available options during initialisation.

Facets are always added to the response, even when empty (like brand in this example).

Conditional facets

Sooqr supports conditional facets. This means that filtering on one facet can trigger a new facet to be shown. These facets are only added when the condition is triggered.