localeContext = $localeContext; $this->productNameNameResolver = $productNameNameResolver; $this->namePropertyPrefix = $namePropertyPrefix; } public function buildQuery(array $data): ?AbstractQuery { $localeCode = $this->localeContext->getLocaleCode(); $propertyName = $this->productNameNameResolver->resolvePropertyName($localeCode); if (!$name = $data[$this->namePropertyPrefix]) { return null; } $nameQuery = new Match(); $nameQuery->setFieldQuery($propertyName, $name); $nameQuery->setFieldFuzziness($propertyName, 2); $nameQuery->setFieldMinimumShouldMatch($propertyName, 2); return $nameQuery; } }