Skip to content

[DEFECT] Querying related content on an non-default lang not being respected #34285

@dsilvam

Description

@dsilvam

Problem Statement

#34162 (comment)

When querying the /api/content/_search endpoint, even though languageId: 2 is explicitly requested in the query, the API retrieves the relationship field in the default language (languageId: 1) instead of the requested language.

Image
POST /api/content/_search
{
    "query": "+contentType:Demo1 +languageId:2 +live:true ...",
    "depth": 3
}

As seen in the response below, the parent content is correctly returned in languageId: 2 ("Español"), but the nested relationship returns languageId: 1 ("Item 1 - English").

{
    "text": "Español",
    "languageId": 2, // Correct
    "relationshipField": [
        {
            "title": "Item 1 - English",
            "languageId": 1 // Incorrect - Should be 2 ("Item 1 - Spanish")
        }
    ]
}
Image

Steps to Reproduce

Create a parent content and a child both in a non-default language.
Attempt to retrieve the content and its child in the non-default language.

Problem: the parent comes in the expected language but child does not.

Acceptance Criteria

Language provided in the query is also respected for related content

dotCMS Version

Main / trunk_c02078b

Severity

Medium - Some functionality impacted

Links

https://dotcms.freshdesk.com/a/tickets/34618

Metadata

Metadata

Assignees

Type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions