I already tried the solution in the following question but it didn't help it only explains how to create OOB filters.

I'm using sitecore 10.1 SXA and I need a way to view hierarchical filter in a search page(am using SXA OOB search).

For Example: I have checklist location filter with below values

enter image description here

I want to display all countries and cities like the above photo.

Does anyone knows how to create for example custom search facet/custom tree filter to do so?

1 Answer 1


You can use Content Search API and apply FacetOn() method on IQueryable like this:

context.GetQueryable<SearchResultItem>().Where(predicate).FacetOn(x => x[“Propery1Name”], 1).FacetOn(x => x[“Propery2Name”], 1).GetFacets();

While: Propery1Name is your Country field and Propery2Name is your City field

You can reach more information in this article: here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.