Facet with multiple values

Hi there,
I’m struggling with a problem which seems simple… We have categories AND matching color for each category, our index looks like:

    "category": {
        "color": "#0277BD",
        "name": "Design"

And of course, we want to have a category selector displaying the name and the correct associated color.

We’re using React InstantSearch, and I can’t find a nice solution for that.

We’ve found https://github.com/algolia/instantsearch.js/issues/2568 as a workaround solution, but I find this solution inelegant. This issue is one year old, is there another solution nowadays?


The best solution is still the one we use on the product demo. Put name and rgb value both in the same attribute, since filtering can only happen on attributes, and has no context of the objects used.

As described in that issue, you can separate them with a character that doesn’t occur otherwise. You might even be able to filter out the rgb value if you put it like this: "#0277BDDesign" by doing a substring of the first 7 characters.

Does that help?

I will say… yes :slight_smile:
thank you for the confirmation!

1 Like