Create extra field for search api attachment content

Created on 20 December 2023, 11 months ago
Updated 14 September 2024, 2 months ago

Problem/Motivation

When trying to use the general field provided by the module for file contents, there is no way of displaying and using it in view modes.

Proposed resolution

Create an extra field 'search_api_attachments' that stores the field file's content, extracted via one of the module extractors, for all entity display modes. Use the created field for further needs.

✨ Feature request
Status

RTBC

Version

9.0

Component

Code

Created by

🇧🇬Bulgaria shaxa

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

Comments & Activities

  • Issue created by @shaxa
  • 🇧🇬Bulgaria shaxa
  • 🇧🇬Bulgaria shaxa
  • 🇧🇬Bulgaria shaxa
  • Status changed to Needs review 3 months ago
  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia
  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

    Currently going through this issue and the suggested fix. I’ll post my review soon.

  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

    After completing the installation of the module, applying the relevant patch, and configuring both the module and the Apache Tika extractor, I conducted a series of comprehensive tests. The results confirm that it is now possible to utilize file content in view modes.

    Below are images illustrating the process and the results obtained:

    1. Article display configuration

    2. Article edit with attached file

    3. Attachment presented as a generic file

    4. Attachment with content displayed

    Based on my testing, I can confirm that the requirements are being adequately met.

    I welcome any additional comments or suggestions.

  • Status changed to RTBC 2 months ago
  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia
  • 🇫🇷France izus

    hi,
    thanks for this work
    did you test the case where we have many file fields :
    example :
    field1 with one.pdf
    and
    field2 with two.pdf
    does the extra field behave well to display both of pdf content in a single view mode ?

  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

    Hi Izus, thank you for your observation and comment.

    I conducted the tests by creating a new content type with two file fields (Multi-file Article):

    I then created a test content item using this content type:

    Both files are displayed correctly in a single view mode, as shown:

    However, I noticed a potential issue: if the content of the first PDF file is too lengthy, the entire text is rendered on the page, which may push down or obscure the content of the second file. This behavior might require a solution, such as limiting the displayed content length.

    I remain open to any further comments and/or suggestions.

    • 38e7a9e4 committed on 9.0.x
      Issue #3409937 by shaxa, ismaelromero, izus: Create extra field for...
  • 🇫🇷France izus

    this is now merged
    thanks

Production build 0.71.5 2024