How to have hierarchicalMenu in instantsearch

I am using Rails 5, InstantSearch.js and this gem (https://github.com/algolia/algoliasearch-rails)

I follow the documentation in order to configure my index in my Model, but I don’t know how to set a hierarchicalMenu. I want Category > Subcategory. Thanks for your help

class Product < ApplicationRecord
belongs_to :brand
monetize :price_cents
include AlgoliaSearch

algoliasearch do

add_attribute :category
add_attribute :subcategory
add_attribute :values_name
add_attribute :values_icon
add_attribute :brand_id
add_attribute :brand_name
add_attribute :name_capitalize

attributesForFaceting [
:values_name,
:brand_name,
:category,
:subcategory,
:price_cat,
'searchable(values_name)',
'searchable(category)',
'searchable(subcategory)',
'searchable(brand_name)',
'searchable(price_cat)'
]
end

Hello!

Thanks for reaching out!

Could you try this code snippet?

add_attribute :category
add_attribute :subcategory do 
  category + " > "  + subcategory
end

Let us know if it helps!

It helps me a lot.
Thank you