- 🇳🇮Nicaragua edysmp Nicaragua
I found something similar with the paragraphs and search_api contrib modules.
scenario:
- display paragraphs' fields in a search api view.
- multiple paragraphs are attached to a nodesearch api view result:
title, paragraph-title, paragraph-text
my article, "paragraph 1, paragraph 2, paragraph 3, paragraph 4", "my text 1, my text 4, my text 4, my text 4"in the example the bolded text result are wrong. it should be "my text 2" and "my text 3", but the last paragraph content is displayed instead "my text 4". this is the same behavior if view's field are interchanged:
my article,"my text 1, my text 2, my text 3, my text 4" "paragraph 1, paragraph 4, paragraph 4, paragraph 4"
debugged the issue and the related code is in `Drupal\views\Entity\Render\EntityFieldRenderer::buildFields`.
i came with a fix that is to pass the rendering `$field` to the buildFields method so the valueIndex from the search_api code refers to the correct field. in the current code the $field is always gathered from the first field witch when rendering the second field gets the wrong valueIndex value which is used to get the actual paragraph entity.
the issue could be fixed in search_api itself because it extends the `EntityFieldRenderer` class, but maybe it worth finding a solution in core.
- 🇳🇮Nicaragua edysmp Nicaragua
attaching the patch. take a look and advice on next steps. ty.
- 🇮🇳India vinmayiswamy
Hi, I followed the steps outlined in the issue summary but couldn't reproduce the issue. The view correctly displays the proper images for both fields.
My local setup specifications:
- Drupal 11.x
- PHP 8.3
- Search API 8.x-1.35
- Default database server for indexing
- Forma
tter: Render Entity
Everything worked as expected, with no issues in image rendering. If there are any additional steps or scenarios that I may have overlooked, or if there are other aspects I should consider, I would greatly appreciate any guidance.
Thanks!