reactjsalgoliainstantsearch.jsinstantsearchreact-instantsearch

ALGOLIA - Numeric Filters with OR conditio


I have around 2557378 records in ALGOLIA. i am trying to apply few conditions with numericFilters

enter image description here

I need to fetch all a values b values and c values

enter image description here

I used Filter condition as below:

{
    "numericFilters": [
        "A>50 OR B > 0  OR C > 0"
    ]
}

The results for each part showed in below:

enter image description here

The OR condition not work fine. What can be the issue?

Already posted in algolia community : https://discourse.algolia.com/t/numeric-filters/17350?u=thamira.weerakoon

Note: I am not expect A and B and C as below

enter image description here

Summery:

I need to fetch all A value B values and C values via react InstantSearch


Solution

  • From what I read from the usage notes on numericFilters

    you may have to try the array notation mentioned here.

    i.e you may have to use it like

    {
        numericFilters: [[ "A>50", "B>0",  "C>0"]]
    }
    

    I tested with the OR conditions on a dummy index I created and it seems to short circuit after the first OR condition for example "A>50 OR B>0 OR C>0" gave me the hits with A>50 only and changing the order to something like "C>0 OR A>50 OR B>0" gave me C>0 only