wp-graphql / wp-graphql-tax-query

Adds `tax_query` support to postObject connection queries using WP_Query
46 stars 16 forks source link

0.1.0 AND & OR relation do the same thing is using more than 2 taxonomies #29

Closed koraysels closed 2 years ago

koraysels commented 2 years ago

this query

{
  projecten(
    where: {taxQuery: {
      relation: AND, 
      taxArray: [
        {terms: ["workshop"], taxonomy: CATEGORY, operator: IN, field: SLUG}, 
        {terms: ["podcast"], taxonomy: TAG, operator: IN, field: SLUG}, 
        {terms: ["kinderen"], taxonomy: LEEFTIJD, operator: IN, field: SLUG}
      ]
    }
    }
  ) {
    edges {
      node {
        link
        date
        title
      }
    }
  }
}

displays the exact same result as this one

{
  projecten(
    where: {taxQuery: {
      relation: OR, 
      taxArray: [
        {terms: ["workshop"], taxonomy: CATEGORY, operator: IN, field: SLUG}, 
        {terms: ["podcast"], taxonomy: TAG, operator: IN, field: SLUG}, 
        {terms: ["kinderen"], taxonomy: LEEFTIJD, operator: IN, field: SLUG}
      ]
    }
    }
  ) {
    edges {
      node {
        link
        date
        title
      }
    }
  }
}

Narmally the second query (with relation: OR) should display much more posts because there are a lot of posts with tag 'podcast'.

What is going on ?

koraysels commented 2 years ago

it appears to have been fixed in PR https://github.com/wp-graphql/wp-graphql-tax-query/pull/19