You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I am facing an issue when defining a facet for a non-translatable attribute. In Elasticsearch, non-translatable attributes are indexed with properties formatted as attribute_attributecode_ (without a locale suffix). However, the BitBag\SyliusElasticsearchPlugin\Facet\AttributeFacet class requires a LocaleContextInterface and always queries attribute_attributecode_localecode, even when the attribute is non-translatable. As a result, no results are returned for such facets.
For example, my configuration looks like this:
bitbag_sylius_elasticsearch_plugin.facet.attribute.filter_cooking:
class: BitBag\SyliusElasticsearchPlugin\Facet\AttributeFacet
arguments:
- '@bitbag_sylius_elasticsearch_plugin.property_name_resolver.attribute'
- '@=service("sylius.repository.product_attribute").findOneBy({"code": "filter_cooking"})'
- '@sylius.context.locale' # here is the locale that is required by the class
BitBag\SyliusElasticsearchPlugin\Facet\AttributeFacet
private function getFieldName(): string
{
return sprintf(
'%s_%s.keyword',
$this->attributeNameResolver->resolvePropertyName((string) $this->getProductAttribute()->getCode()),
$this->localeContext->getLocaleCode() // This is where the locale causes a problem, as it is not nullable
);
}
Is there an existing solution or workaround for this issue?
The text was updated successfully, but these errors were encountered:
Hello!
I am facing an issue when defining a facet for a non-translatable attribute. In Elasticsearch, non-translatable attributes are indexed with properties formatted as attribute_attributecode_ (without a locale suffix). However, the
BitBag\SyliusElasticsearchPlugin\Facet\AttributeFacet
class requires aLocaleContextInterface
and always queries attribute_attributecode_localecode, even when the attribute is non-translatable. As a result, no results are returned for such facets.For example, my configuration looks like this:
Is there an existing solution or workaround for this issue?
The text was updated successfully, but these errors were encountered: