Problem/Motivation

When a file does not exist, we still add the empty string as a value for the field. Solr then adds the placeholder text which results in "aöbäcüdöeäfüg" being added to the index. In our case, we aggregate multiple search attachment fields together which results content being wrapped with this placeholder.

Proposed resolution

We add a simple check to see if the $extraction is not empty, and only add if it contains some type of output.

if (!empty($extraction)) {
     $field->addValue($extraction);
}
CommentFileSizeAuthor
empty-output.png102.49 KBj-barnes
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

j-barnes created an issue. See original summary.

j-barnes’s picture

Status: Active » Needs review
izus’s picture

Status: Needs review » Needs work

Thanks for this contribution
looks like it needs a rebase to be mergeable

j-barnes’s picture

Status: Needs work » Needs review

Updated, thanks!

izus’s picture

Assigned: j-barnes » Unassigned
Status: Needs review » Fixed

merged
thanks

  • izus committed 170eda6a on 9.0.x authored by j-barnes
    Issue #3483447: Prevent empty string values from being added.
    
izus’s picture

Status: Fixed » Closed (fixed)

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