Search code examples
ravendbfaceted-search

RavenDB Faceted Search: how to build fecets on category specific attributes


I have product documents with two types of attributes. General attributes that applies for each product and category specific attributes which vary by each product category.

{
  // Product general attributes
  "Title": "",
  "Brand": "",
  "Category",
  ...,

  // Category specific attributes
  "Attributes": [
    {
      "Name": "",
      "Value": ""
    },
    {
      "Name": "",
      "Value": ""
    },
    {
      "Name": "",
      "Value": ""
    },
    ...
  ]
}

The names in 'Attributes' array are all different.

My question is how can I build facets on attribute names of category specific attributes?


Solution

  • You need to output those to the index as dynamic fields. See here: http://ravendb.net/docs/2.0/client-api/advanced/dynamic-fields Then you need to specify them in the facets that you want to get back.