Skip to content

Commit

Permalink
#81 : Flatten array structure during indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien FOUCRET committed Jul 12, 2016
1 parent 75af0ea commit 9862a8a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/module-elasticsuite-catalog/Helper/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,17 @@ public function prepareIndexValue(AttributeInterface $attribute, $storeId, $valu
$value = [$value];
}

$values[$attributeCode] = $value = array_filter(array_map($simpleValueMapper, $value));
$value = array_map($simpleValueMapper, $value);
$value = array_filter($value);
$value = array_values($value);
$values[$attributeCode] = $value;

if ($attribute->usesSource()) {
$optionTextFieldName = $this->getOptionTextFieldName($attributeCode);
$values[$optionTextFieldName] = array_filter($this->getIndexOptionsText($attribute, $storeId, $value));
$optionTextValues = $this->getIndexOptionsText($attribute, $storeId, $value);
$optionTextValues = array_filter($optionTextValues);
$optionTextValues = array_values($optionTextValues);
$values[$optionTextFieldName] = $optionTextValues;
}

return array_filter($values);
Expand Down

0 comments on commit 9862a8a

Please sign in to comment.