Skip to content

[5.x]: GraphQL search does not return renamed text field, while Craft search does #18239

@rensmaljers

Description

@rensmaljers

What happened?

Description

We are encountering an inconsistency between Craft’s native search and GraphQL search when reusing and renaming a text field within an entry.

Problem

When a text field is reused for a different purpose (same field, different context/name) and contains content, the field is searchable in the Craft Control Panel, but cannot be found using a GraphQL search query.

GraphQL search only works if the original field handle is used, not the renamed context in which the field is currently used.

Steps to reproduce

1.	Create a text field (e.g. textUntranslatable) ,check searchable
2.	Use this field in Section A and fill it with content
3.	Reuse the same field in Section B, but give it a different name/label in the layout
4.	Create an entry in Section B and fill the field with searchable text
5.	Search for this text:
•	In Craft CP → works as expected
•	Via GraphQL search argument → no results returned

Expected behavior

GraphQL search should return entries based on the actual stored content, regardless of:
• Field reuse
• Renaming/relabeling in a different field layout context

This should behave consistently with Craft’s native search.

Actual behavior

GraphQL search does not return entries when the field is reused under a different name/context, even though:
• The content exists
• Craft CP search finds it correctly

Craft CMS version

5.8.22

PHP version

8.3.27

Operating system and version

No response

Database type and version

mariadb 10.6

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions