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.

Comments

ShaxA created an issue. See original summary.

shaxa’s picture

StatusFileSize
new2.22 KB
shaxa’s picture

StatusFileSize
new2.5 KB
shaxa’s picture

StatusFileSize
new2.58 KB
ismaelromero’s picture

Status: Active » Needs review
ismaelromero’s picture

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

ismaelromero’s picture

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

    Article display configuration

  2. Article edit with attached file

    Article edit with attached file

  3. Attachment presented as a generic file

    Attachment presented as a generic file

  4. Attachment with content displayed

    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.

ismaelromero’s picture

Status: Needs review » Reviewed & tested by the community
izus’s picture

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 ?

ismaelromero’s picture

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):
The multi-file article ContentType

I then created a test content item using this content type:
Create multi-field article ContenType

Both files are displayed correctly in a single view mode, as shown:
Test multi-file ContentType

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...
izus’s picture

Status: Reviewed & tested by the community » Fixed

this is now merged
thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.