Hi, when using the HierarchicalMenu from 'react-in...
# community-help
g
Hi, when using the HierarchicalMenu from 'react-instantsearch-dom' can we restrict the component so that search will be on a specific collection ?
j
@gab gab IIRC by default it only works on a single collection...
May be I don't understand the question fully
g
In fact I have 2 collections (2 indexes) used in the <InstantSearch/> context. So when I try to use inside the HierarchicalMenu it tries to query the categories fields in both collection. But in my case I only have those categories on one collection.
Copy code
<InstantSearch>
  <Index indexName="col1" />
  <Index indexName="col2" />

  <HierarchicalMenu attributes={['categories.lvl0']}/>
</InstantSearch>
I saw I could have multiple InstantSearch context but I would like to avoid
j
I haven't tried this myself... May be try nesting HierarchicalMenu within an Index element?
Something like this:
Copy code
<Index indexName="col2">
   <HierarchicalMenu attributes={['categories.lvl0']}/
</Index>
g
Ah you're right, that's working well, thanks !
👍 1