Indexing attributtes for HierarchicalMenu use


I am implementing algolia in my rails-react app. It is a shop app. I want to replace the navigation between categories with Algolia Search. I am stucked while implementing HierarchicalMenu:

I did index all my items and am able to search through it. They do each have a category name (taken from an other table, indexed through my Item table). I also did index the categories separately but I am not using that indexation so far.

I can see all categories which has an item when using ‘RefinementList’ but don’t se them with HierarchicalMenu.

Is there a way I can format the categories / sub categories directly from the dashboard ?

“categories.lvl0”: “légumes”,
“categories.lvl1”: “légumes > Pommes de terre”,
“categories.lvl2”: “légumes > Carottes”,
“categories.lvl3”: “légumes > Salades”,
“categories.lvl4”: “légumes > Choux”,
“categories.lvl5”: “légumes > Tomates”,
“categories.lvl6”: “légumes > Cucurbitacés”,
“categories.lvl7”: “légumes > Autres légumes”,

or, if that is not possible, is there a way to connect two indexation from the dashboard ?

I must say, I am a bit lost on how I shall work with these indexation.

Thank you for your help

Hi, hierarchical menu is meant to be used to have a the list of categories the current hits are belonging to.

So for example you would have:

  "objectID": "1",
  "categories.lvl0": "légumes",
  "categories.lvl1": "légumes > Pommes de terre",
  "name": "charlotte"
}, {
  "objectID": "2",
  "categories.lvl0": "légumes",
  "categories.lvl1": "légumes > Salades",
  "name": "batavia"  

And on the UI you would then see:

  • légumes
    • pommes de terre
    • salades

Clicking on légumes would show them all, clicking on pommes de terre would only show charlotte pommes de terre.

Since it seems you tried to use hierarchicalMenu to build something else, can you show us maybe some screenshot on what you are trying to build and how it relates to Algolia search?


Thank you for your answer. It is much more clearer for me now.

So each product has to be indexed with the different categories + level it has.

I’ll try to get these info from my DB indexed that way.

May I ask you which tutorial you followed that may be was not obvious/well written? Thanks!

Here you are :wink:

Thank you again

Nice, just updated the documentation: