Closed zakdma closed 2 months ago
Hello @zakdma,
Indeed, by default, for select and multiselect, the facets/aggregations are computed on the field containing the untouched labels of options. But it does contain the counts associated to each option, which should be pretty much the same thing considering than Magento does not allow you to have duplicate labels.
Out of curiosity, why do you need to build the facets/aggregations on the optionId instead exactly ? Is it for tracking purposes ?
Anyway, one way would be to create a plugin on \Smile\ElasticsuiteCatalog\Helper\ProductAttribute::getFilterField and on a per-attribute or per-attribute type basis, decide to change the field used but you'll probably safer to override both
Regards,
Hi! Yeah its a workarond but it would be great to have such ability by configuration. I mean make a configuration to decide use option_text_attribute_code or attribute_code. Now its hardcoded. Anyway, thank you for response.
They will be part of our module that are somehow "hardcoded" to provide its features, but it does provide extension/override points. It felt logical at design time to make facets on the "untouched" label of select/multiselect because it does avoid having to reload the options.
Anyway, you're welcome @zakdma
Hi! I have a problem with code that use faceted data to build some output. Elasticsuite replaced
\Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection
with\Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection
This collection has methodgetFacetedData
that behaves differently than Magento core one. Core return data forattribute_code
and attribute option ID so I can easily identify counts linked to options But your implementation returnsoption_text_attribute_code
. And its has not option ID rather option text. So I cannot easily identify option by it. Is there any possibility of getting faceted data for attribute_code?Thank you.