Add support for Paragraph entities

Created on 31 December 2024, 2 months ago

Problem/Motivation

Assume we have a generic search index containing Nodes (Article, Advanced Page) and Paragraphs (various bundles containing title & body fields). Articles have a body field, Advanced Page has a multivalue paragraphs field. Articles are indexed. Advanced Page nodes are not indexed; their paragraphs though are indexed.
Upon clicking an article node, the user should get redirected to the node page; already supported by this module.
Upon clicking the paragraph entity, the user should get redirected to the advanced page node with the specific paragraph somehow set as active (eg. via a query argument). This functionality is supported by implementing in a custom module the hook_search_api_autocomplete_suggestions_alter() function... This is not enough though since the Live Results processor skips anything that doesn't have a canonical URL.
So to sum up, even though the paragraphs do come as a result from the index, the suggester doesn't display them.

Proposed resolution

From my point of view, there are two possible ways of solving this issue:

  • Add explicit support for Paragraph entities
    This has the downside that it opens the road for other module requests in the future which you might not be willing to do.
  • Introduce a new hook to modify the URL retrieved for the entity.
    This is much more simple and dynamic and with a proper description in the *.api.php file, nothing more should be required from your side.

Remaining tasks

Decide on the approach to use.

User interface changes

None.

API changes

Possibly new hook introduced.

Data model changes

None.

✨ Feature request
Status

Active

Version

1.0

Component

Plugins

Created by

🇬🇷Greece vensires

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024