Solving the SXA Facet Filter Component Bug

Sitecore Hints & Tips

Today while testing, we found that the out-of-the-box facet filter component doesn't work as expected. After digging into the code, we realised it was a Sitecore SXA bug. So we've decided to share this in with the hope that it can help you understand the issue and quickly solve it.

The Bug

The screenshot below has three properties. For testing purposes, we assigned a different property type for each of them. The expected filter result should return one of each type of property (Apartment, House & Land and Townhouse). However, it shows two items per type. Why?!

Sitecore Newsletter subscription facet

The Solution

Our first thought was that it was because of the use of multiple languages on the site but after looking into the code, we found the answer! The facet component ONLY takes the search scope as its search criteria, which means the results contain multiple items with different languages.

Here is the screenshot for the index. As you can see, it has two items with the lottype equal to "House and Land" one is the Chinese version and the other the English version. That's why, even though there should only be one item per type, the facet indicates two items per type in the example above. This bug can cause the discrepancy we found between the search results and the facet filtering on multi-language websites.

Sitecore Daterange field

Fortunately, this bug has been fixed in SXA 1.6. For all previous versions, please create a ticket in the Sitecore Support Portal to request the patch for your SXA version.


We hope that you found this post useful and enjoyed the article.

— Zhen Yuan

Want more?

Back to the Blog

Sydney
Suite 302
28 Margaret Street
Sydney NSW 2000
Phone 02 8188 5959
Melbourne
Level 2
696 Bourke St
Melbourne VIC 3000
Phone 03 8566 8819
Phone 02 8188 5959