public function aroundGetFilterArray(
        \Magento\Swatches\Model\ProductSubstitute $productSubstitute,
        \Closure $proceed,
        array $request
    ) {
        $filterArray = $proceed($request);

        $attributeCodes = $this->eavConfig->getEntityAttributeCodes(\Magento\Catalog\Model\Product::ENTITY);

        foreach ($request as $code => $value) {
            if (in_array($code, $attributeCodes)) {
                $attribute = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $code);

                if (isset($filterArray[$code]) && !is_array($filterArray[$code])) {
                    $filterArray[$code] = [$filterArray[$code]];
                }

                if ($attribute->getId() && $productSubstitute->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code][] = $this->swatchHelper->getOptionIds($attribute, $value);
                }
            }
        }

        return $filterArray;
    }