cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect Live Search facet bucket titles for attribute with custom source model

Incorrect Live Search facet bucket titles for attribute with custom source model

We're working on installing Live Search and have encountered a problem with the titles of facet buckets for a custom EAV attribute we have that uses a custom source model to store the attribute options in a dedicated table. In the specific case, the attribute holds the value of the author of a product, and the author title is stored in a column called author_name in the table. The source model extends Magento\Eav\Model\Entity\Attribute\Source\AbstractSource and implements getOptionText and getAllOptions methods to handle retrieving the author_name columns as the option label, and everything works fine elsewhere in the site, including the in the layered navigation filters, which correctly show the author_name field as the option titles.

 

But it seems we're missing something in the attribute configuration, since the titles of the facet buckets end up being the IDs of the rows in the source table instead of author_name, so that when we use the Product Listing Page Widget, the facet filter options display those IDs as the labels. We're aware of the requirement for using the Widget if we're using an attribute with a custom source model, so we can't revert to using the normal layered navigation.

Can anyone provide any guidance about what exactly is required in an EAV attribute's configuration to ensure that Live Search uses the desired column as the bucket title?

6 REPLIES 6

Re: Incorrect Live Search facet bucket titles for attribute with custom source model

Hi @atalcottha1577 ,

The search adapter does not support product attributes that are created with a custom source model and used as facets. To support this functionality, you must use the Product Listing Page Widget.

Reference: https://experienceleague.adobe.com/en/docs/commerce/live-search/boundaries-limits

 

Problem Solved? Accept as Solution!

 

Thanks,

Ankit

Ankit Jasani

Re: Incorrect Live Search facet bucket titles for attribute with custom source model


<p>Magento Live Search uses the Elasticsearch schema to generate facets, and if the attribute uses a custom source model, it may require additional mapping to ensure the correct label is used in the bucket titles. It could help to check if the attribute's frontend label or source model is being interpreted during the reindexing process and that the <code>getAllOptions()</code> method includes all necessary label translations.</p>

Re: Incorrect Live Search facet bucket titles for attribute with custom source model

In SnapTube Pro, incorrect Live Search facet bucket titles appeared for attributes using a custom source model. This caused confusion in search filters, displaying inaccurate or mislabeled categories. The issue stemmed from misconfigured attribute labels in the source model, impacting the overall user search experience and content discoverability. @nandlafahe98fe @atalcottha1577 

Re: Incorrect Live Search facet bucket titles for attribute with custom source model

When using Magento Live Search with a custom EAV attribute that relies on a custom source model, such as an "author" attribute stored in a separate table with labels like author_name, facet bucket titles may incorrectly display the option IDs instead of the intended labels. This happens because Live Search doesn't support custom source models for facets—it expects option labels to be stored in Magento's standard eav_attribute_option_value table. Since your custom attribute pulls labels from a dedicated table, Live Search cannot access them directly, resulting in IDs being shown as facet labels. To resolve this, you'll need to synchronize your custom labels into the eav_attribute_option_value table, either through a custom data sync, an indexer extension, or a plugin that populates these values alongside your custom source model. Alternatively, if using Live Search is not a strict requirement, sticking to Magento’s standard layered navigation will correctly display the custom labels, as it supports custom source models out of the box. Another workaround is to use frontend JavaScript to map the displayed IDs back to their labels at runtime, but this is more of a patch than a true fix. Ultimately, the cleanest solution is ensuring Live Search can access labels in the format it expects.

Re: Incorrect Live Search facet bucket titles for attribute with custom source model


@tatetopggg93cb wrote:

When using Magento Live Search with a custom EAV attribute that relies on a custom source model, such as an "author" attribute stored in a separate table with labels like author_name, facet bucket titles may incorrectly display the option IDs instead of the intended labels. This happens because Live Search doesn't support custom source models for facets—it expects option labels to be stored in Magento's standard eav_attribute_option_value table. Since your custom attribute pulls labels from a dedicated table, Live Search cannot access them directly, resulting in IDs being shown as facet labels. To resolve this, you'll need to synchronize your custom labels into the eav_attribute_option_value table, either through a custom data sync, an indexer extension, or a plugin that populates these values alongside your custom source model. Alternatively, if using Live Search is not a strict requirement, sticking to Magento’s standard layered navigation will correctly display the custom labels, as it supports custom source models out of the box. Another workaround is to use frontend JavaScript to map the displayed IDs back to their labels at runtime, but this is more of a patch than a true fix. Ultimately, the cleanest solution is ensuring Live Search can access labels in the format it expects.


The problem with synchronizing custom labels into eav_attribute_option_value is that since a custom source model stores its label/options in a separate table, there will be overlap and conflict between the primary keys (option_ids) in eav_attribute_option_value and the primary keys in that separate table. 

 

The Boundaries and Limits document clearly directs us to use the Product Listing Widget if we're using a custom source model, but in fact the Product Listing Widget does not appear to work with our custom source model, even though that model appears to implement all documented requirements.

Re: Incorrect Live Search facet bucket titles for attribute with custom source model


@Ankit Jasani wrote:

Hi @atalcottha1577 ,

The search adapter does not support product attributes that are created with a custom source model and used as facets. To support this functionality, you must use the Product Listing Page Widget.

Reference: https://experienceleague.adobe.com/en/docs/commerce/live-search/boundaries-limits


As stated, we are aware of the limitation, and we are using the Product Listing Page Widget. That's where we're seeing the incorrect titles. If we attempt to use the Layered Navigation, the attribute with a custom source model does not appear at all in the filters, as expected.