IndexResource query does not respect language (with database search back-end)

Created on 3 December 2022, over 2 years ago
Updated 14 May 2025, 24 days ago

Problem/Motivation

The search api query used in IndexResource doesn't take into account current language in the filter. Consequently, when filtering by a field, it returns result count in all languages rather than in provided one.

Is this by design?

Proposed resolution

If this is a bug, the process method query should probably include current language condition.

Remaining tasks

The IndexResourceTest tests would need to be updated to take into account the language filter.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇪Georgia davit.magaldadze

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.

  • 🇫🇮Finland kirsij

    I tried applying this patch to the latest version of jsonapi_search_api and encountered a fatal PHP error:

    PHP Fatal error: Cannot redeclare Drupal\jsonapi_search_api\Resource\IndexResource::$eventDispatcher in /modules/contrib/jsonapi_search_api/src/Resource/IndexResource.php on line 62

    It looks like the patch adds the $eventDispatcher property to the IndexResource class, but that property already exists in the current version of the module. This causes a duplicate declaration error.

Production build 0.71.5 2024