react-instantsearch icon indicating copy to clipboard operation
react-instantsearch copied to clipboard

Feature-Request: Hierarchical Menu as a disjunctive facet

Open nexnbeach opened this issue 7 years ago • 10 comments

Need Hierarchical Menu that is disjunctive. react-instantsearch 3.2.1 is current;y being used Similar to Refinement List but in a tree format.

Use case when be when filtering by location and want to have multiple locations possible.

EX.

Index has record attribute... record 1

geography: {
   lvl0: "North America",
   lvl1: "US",
   lvl2: "MI"
}

record 2

geography: {
   lvl0: "Asia-Pacific",
   lvl1: "China"
}

Hierarchical Menu only allows one to be selected, need to be able to expand both North america and Asia-pacific and filter by Asia-Pacific>China or North America>US

nexnbeach avatar Apr 11 '17 13:04 nexnbeach

:+1:

klacointe avatar Jan 16 '18 15:01 klacointe

Just for reference, we do hear you, but this is very complex to achieve. It's in our longer-term road map. Feel free to react with 👍 to the original post so we can sort this by amount of people requesting the feature

Haroenv avatar Jan 16 '18 16:01 Haroenv

Hey, just wondering if there have been any updates that resolve this issue? @Haroenv you mentioned this being on the longer-term roadmap? 🗺

I've arrived here from the closed issue in the instantsearch.js repo as I'm trying to achieve the same result - a multiselect hierarchical menu. Definitely feels like there's a solid use-case for it so would be brilliant to see it added to such a comprehensive library 👏

Thanks!

pragmatic-tf avatar Jul 19 '19 12:07 pragmatic-tf

Hey @pragmatic-tf, we discussed this for our roadmap this quarter, but decided not to because this would have a lot of requests (one for every open level + 2) and require us to rebuild one of the most complicated parts of the code.

However one of our solution engineers (@rgalite) made a workaround for InstantSearch.js using multiple hierarchical menus to allow this for the root level: https://codesandbox.io/s/instantsearchjs-disjunctivehierarchicalmenu-zl3rm with the same number of requests tradeoff

Haroenv avatar Jul 19 '19 15:07 Haroenv

Hi @Haroenv the example above no longer works with instantsearchjs 4.0 and above. Has there been any developments in implementing a working widget for this?

dianos avatar Jun 22 '21 15:06 dianos

You're right, the widget indeed doesn't seem to work anymore in InstantSearch v4, although I'm not sure what caused it to fail

I've done a trial at upgrading, but got stuck here: https://codesandbox.io/s/instantsearchjs-disjunctivehierarchicalmenu-zl3rm?file=/src/custom-disjunctive-facets.js, I'm assuming it tries to read from the wrong results or something like that.

At the moment we haven't seen this as a priority, but would love to hear what your tradeoffs are for this widget @dianos. What experience do you want to create?

Haroenv avatar Jun 23 '21 07:06 Haroenv

Hi @Haroenv, it appears that before an array of values for the 2nd level was being returned, while right now an object is returned but it's also missing the 2nd level values.
I'm trying to have the Hierarchical Menu display attributes and allow the selection of multiple attributes, it does work very well for displaying them, but you can currently only select one.

dianos avatar Jun 24 '21 13:06 dianos

Your example worked up to version 3.7 of instantsearchjs. Changes done in version 4.0 broke it.

dianos avatar Jun 24 '21 13:06 dianos

Our team could really use this feature. Haroenv if this is possible to fix the workaround or update Algolia, my team would greatly appreciate the effort!

khahn-hw avatar Apr 12 '22 18:04 khahn-hw

Hey there @khahn-hw I think I made it work. In the custom-disjunctive-facets.js file, try adding this line to the init method right below this.helper = helper.

helper.state = this.helper.state.addDisjunctiveFacet(this.lowlevelAttribute);

jsanzlopez avatar Sep 06 '22 16:09 jsanzlopez

Moving this into a Discussion since this is a feature request and not a bug.

sarahdayan avatar Dec 20 '22 10:12 sarahdayan