Trouble filtering entries by taxonomy in GraphQL #4983
-
I'm having trouble filtering entries by a taxonomy/term using GraphQL. Putting together the docs on Taxonomy conditions and GraphQL filtering, it looks like I should be able to filter entries like this:
Instead, I get back a list of all the entries in the "wikis" collection instead of just the ones with the specific term I requested. Is this a bug with the GraphQL API, or am I building the query wrong? I'm not getting any errors or anything. I'm on Statamic 3.2.23 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
hey @andyra try this: |
Beta Was this translation helpful? Give feedback.
-
On Statamic 4.36.0 I still have the exact same question: how would you write a query for entries having ONE of multiple taxonomy terms? I searched the documentation, and I tried lots of different queries, but I can't find out how to send an OR query by graphQL in Statamic. I managed to send an AND query though - this query successfully returns all entries having term "social-media" AND term "screen-design":
But I can't manage to build an OR query - returning all entries having at least one of the terms. The documentation says, I can use any of the supported tag conditions: But especially the taxonomy conditions cannot really be used in graphQL: https://statamic.dev/conditions#taxonomy-conditions I found a similar issue, without any answers unfortunately: statamic/ideas#914 Does anybody have an idea how to build a simple OR query like that in graphQL? |
Beta Was this translation helpful? Give feedback.
hey @andyra try this:
taxonomy: { contains: "buildings" }