Multiple OR queries in GraphQL

System Information
  • Strapi Version: 3.3.4
  • Operating System: Windows 10
  • Database: Postgre
  • Node Version: 14.12.0
  • NPM Version: 6.14.8
  • Yarn Version: 1.22.5

Hey.
I’m trying to build a query where multiple values can be either null or greater than (x), so my approach is to create a series of OR/AND statements like so:

(value_null: true OR value_gte: $num) AND (period_null: true OR period_gte: $num)

I would also like to use this and/or configuration for other uses in the future, like fuzzy matching across various fields, like:

(name_contains: $search_term OR description_contains: $search_term) AND (... other parameters)

However, Strapi doesn’t seem to support multiple separate OR queries. I was only able to find documentation on a single OR that can support multiple ANDs, but not the other way around. I can use

where: { _or: [ {params}, {params} ] }

But not

where: {_and: [ {params}, {params} ] }

…or any other way to word it I could think of

Is there any way to do something like this without diving deeper into the code? If not, could someone point me in the general direction I would need to look in order to implement it?

Thanks in advance.

1 Like

Anyone?..

1 Like

Did you find any solution?