Hi together

i am experiencing a problem while indexing a List (Text) field, if the key of the option is "0".

So the allowed values for the field are

"0": "available"
"1-3": "available in maximum 3 days"
"4-7" "available within a week"

While indexing a product that is "available", the field is not getting indexed.

I found an issue, that looks related, but since I am using the latest version, the patch in there is already attached.
https://www.drupal.org/project/search_api_solr/issues/3000123

In my opinion the condition in the \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::addIndexField for strings is not correct, since it will not index if the string is "0".

// No break, now we have a string.
  case 'string':
  default:
    // Keep $value as it is.
    if (!$value) {
      continue 2;
    }

If i change the condition for example to
if (!$value && strlen($value) == 0) { i am getting the result indexed as i would expect it.

What do you think? Am i missing something?

Thank you for your feedback

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

megadesk3000 created an issue. See original summary.

megadesk3000’s picture

Issue summary: View changes

mkalkbrenner made their first commit to this issue’s fork.

mkalkbrenner’s picture

Version: 4.2.7 » 4.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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