Multiple RefinementLists with OR operator? (React InstantSearch)

Greetings:

Is there a way to place multiple RefinementList facted filters while using an OR operator?

In a single filter, we can set operator: “[and/or]”

but when there is more than one filter the search defaults to “AND” between the filters (even if each individual filter is set to “OR”.)

Thanks!

Hi there,
Thanks for reaching out to us.
I’m afraid I don’t understand your question correctly.

Do you want everything to be disjunctive across filters?

For example,

<RefinementList attribute="brand" operator="or" />

(operator=“or” is the default value, though).

Within the refinement list, if you click “Apple” and “Samsung” it will be “brand=Apple or brand=Samsung”.

Let’s say we have another refinement list.

<RefinementList attribute="type" />

And there you click “Phone” and “Case” then it will be “type=Phone or type=Case”.

And is what you want something like

“brand=Apple or brand=Samsung or type=Phone or type=Case”

instead of

“(brand=Apple or brand=Samsung) and (type=Phone or type=Case)” ?

Let me know if I understand your question correctly.

Hi @eunjae.lee – I think you understood correctly:

RefinementList attribute=“brand” operator=“or”
RefinementList attribute=“type” operator=“or”

  1. Select “brand=Apple” + “brand=Samsung”
  2. Select “type=phone” + “type=case”

In this scenario, I need to return this:

brand=Apple OR brand=Samsung OR type=Phone OR type=Case

Is that possible? What I get instead:

brand=Apple OR brand=Samsung AND type=Phone OR type=Case

Thanks for any help!

Hello @tim2,

Indeed, this is the default behavior for the existing RefinementList widget.

If you want disjunctive OR between multiple attributes, I recommend looking into connectRefinementList as this will allow you to create your own widget.