The change to search_api_text can break custom code

Created on 7 July 2025, about 1 month ago

Problem/Motivation

I recently upgraded search_api to 8.x-1.38. Unfortunately, this broke a view on a site. Because Drupal Core lacks proper JSON serialization of fields I wrote a small custom module that does it. I don't want to get into the weeds, but it bridges the work done in the rest_views module with search_api's fields. The custom module has a hook_views_data_alter() implementation that checked for fields using the search_api field handler. If it found one, then it duplicated the field and added the custom serializer handler.

The problem is that when the Search API text fields were switched from the search_api field handler to search_api_text half my fields broke (the text fields). The view started displaying the "Broken/missing handler" warning in the view for all of them because the alter hook no longer acted on them.

It's kind of a gray area in the BC policy whether this broke it. The BC policy says this about plugins:

Particular plugins, whether class based or yaml based, should not be considered part of the public API. References to plugin IDs and settings in default configuration can be relied upon however.

I'd call this a reference to a plugin ID, though I don't know if Views data is considered "configuration." Obviously it isn't part of the configuration API.

I'm not sure what action should have been taken to warn downstream developers about this change. But I wanted to make certain the problem was documented.

Steps to reproduce

Proposed resolution

At a minimum I think there should have been a change record for ✨ Select Text Format in Views Field for textual content with values from search index Needs work . It's possible that the change should have forced the release of version 2.0.0 too.

Remaining tasks

Decide what action should be taken, if any.

πŸ“Œ Task
Status

Active

Version

1.0

Component

General code

Created by

πŸ‡ΊπŸ‡ΈUnited States dcam

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

Comments & Activities

Production build 0.71.5 2024