0 Comments

Today while doing self-testing, I found that OTB facet filter component doesn't work as expected. After digging into the code, it is surely a Sitecore SXA bug.  Therefore,  I decided to share this and hope this can help you to understand the issue and quickly solve it.   

What’s the issue?

The screenshot below, it has 3 properties, and I assigned different property type for each of them (for testing purpose).  The expected result would be Apartment(1), House and Land(1) and Townhouse (1). However, it is indicating (2) items per type?  Why?!

image

My first question was that is this because of multi-languages? After looking into the code, I found the answer, it’s because the facet component ONLY takes the search scope as its search criteria, which means the results contains multiple items with different language.

image

Here is the screenshot for the index,  As you can see It has two items with the lottype equals to “House and Land”, one is Chinese version and the other is English version.  That’s why the facet indicates (2) items per type in the example above. This bug could cause the discrepancy between search results and facet filtering, if you are implementing multi-language website.

image

Fortunately, This bug has been fixed in SXA 1.6, for all previous version please create a ticket in support portal for  requesting the patch for your SXA version.