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 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?!
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.
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.
Subscribe for the latest news and events from our talented team and community network.