Magento 2 search not showing products by multiselect attribute

On by

less than 1 minute read

This is documentation problem.

Multiselect attributes needs to have “Visible in Advanced Search” flag checked in addition to “Use in Search” and “Search Weight” mentioned in documentation.

After this do reindex.

Please see implementation on

// app/code/Magento/CatalogSearch/Model/ResourceModel/Engine.php lines 89-101
private function isTermFilterableAttribute($attribute)
{
    $attributeId = $attribute->getAttributeId();
    if (!isset($this->termFilterableAttributeAttributeCache[$attributeId])) {
        $this->termFilterableAttributeAttributeCache[$attributeId] =
            in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
            && ($attribute->getIsVisibleInAdvancedSearch()
                || $attribute->getIsFilterable()
                || $attribute->getIsFilterableInSearch());
    }
    return $this->termFilterableAttributeAttributeCache[$attributeId];
}

Fixes: (https://github.com/magento/magento2/issues/13972)