/** * Retrieve attribute source value for search * * @param int $attributeId * @param mixed $valueId * @param int $storeId * @return string */ private function getAttributeValue($attributeId, $valueId, $storeId) { $attribute = $this->getSearchableAttribute($attributeId); $value = $this->engine->processAttributeValue($attribute, $valueId); if (false !== $value && $attribute->getIsSearchable() && $attribute->usesSource() && $this->engine->allowAdvancedIndex()) { $attribute->setStoreId($storeId); $valueText = (array) $attribute->getSource()->getIndexOptionText($valueId); $pieces = array_filter(array_merge([$value], $valueText)); $value = implode($this->separator, $pieces); } $value = preg_replace('/\\s+/siu', ' ', trim(strip_tags($value))); return $value; }