Jsonapi filters not returning results if same field from reference fields are passed as filters

Created on 29 June 2021, almost 3 years ago
Updated 18 January 2024, 5 months ago

Problem/Motivation

Hi,
I am facing an issue that i have a node of type news which has 2 taxonomy reference fields.One refers to vocab news_type and other to news_position. The two vocabs have same field in them 'field_tag' but when i am trying to filter out the content using jsonapi it is not working.

Steps to reproduce

1. Create a content type of type news which has 2 taxonomy reference fields.
2. One field references to one vocab "news_type" and the other refers to a different vocab "news_position".
3. Let's say both vocabs have same field "field_tag" in them.
4. Now try to filter out the content using jsonapi.
JSONAPI url:-
jsonapi/news?filter[news_type.field_tag]=Test1&filter[news_position.field_tag]=1234

The API doesn't return any node but if we pass each filter individually then it works fine.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.2

Component
JSON API 

Last updated 2 days ago

Created by

🇮🇳India Chirag_Garg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India sijumpk

    This issue still existing. Was able to recreate it with Drupal 10.2

  • 🇮🇳India sijumpk

    If we add a delta to one of the filter keys, the issue is not happening.
    Eg:

    https://d10dev.ddev.site/jsonapi/node/news?filter[field_news_type.field_tag]=type1&filter[field_news_position.0.field_tag]=position1
    

    But this wont fix the problem if the node taxonomy field is a multi valued one and has multiple terms added.

Production build 0.69.0 2024