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

Switch has been globally recognised winning the Ultimate Sitecore Experience Award for the Most Sophisticated Implementation in 2020.
Read more Experience Awards 2020 Winner

Switch acknowledges the Traditional Custodians of the lands where we live, learn, and work and we pay our respects to their Elders past and present.

Level 6
9 Hunter Street
Sydney NSW 2000
Phone +61 02 8188 5959
Level 2
696 Bourke St
Melbourne VIC 3000
Phone +61 03 8566 8819
New Zealand
11-19 Customs Street West
Auckland 1010

Phone +64 9 887 4657
8 Cross Street
Singapore, 048424

Phone +65 3106 4217
ABN 15 120 572 750   ·   © 2021 Switch

Subscribe Now

Sign up to our newsletter to gain access to more articles like this one

No thanks