We have a specific requirement in sxa search, we want to create a facet based on datasource selected from one of the treelist field which hold some node from content tree, for example Article and Product node. So we need Article and Product in facet and based on selection we want to show the children item in search. Let say if user select Article node then in search result show all children node of Article.

Let say All items under specific node which selected in treelist but how can we make it as facet. Assume we have below content tree structure :


  • Products
    • Product 1
    • Product 2
  • Articles
    • Article 1
    • Article 2
  • Events
    • Event1
    • Event2

If we select below node from treelist for facet source : Products Articles

Facet must be look like

Section (facet title) Products Articles

Assume if user select "Products" then search result must be:

Product 1 Product 2 Suggestions will be appreciated :)

  • Would you be able to share visual designs showing how it should work? May 8, 2021 at 4:59
  • One way is to design the tree list as you explained and once user click you can pass value to search page as query string parameter and filter the results.
    – Amit Kumar
    May 8, 2021 at 8:06

1 Answer 1


Facets work on fields. So you should have a field in your items that determines if the item is a product or an article (or ...). This could be the template, but that is rarely named as you want it.

I solved a similar issue with a computed field. I added a computed field into my (sxa) index that contains the text you want as facet based upon the logic you need. So, in your example you should store "Products" for each product item, "Articles" for each article item and so on...

Once this is done (don't forget to rebuild the index to populate the newly created computed field), you can create the facet on this computed field.


Based upon your comment, the question became a bit more clear. If you want the content authors to select which results a search should contain, you don't need a facet but a scope. You can read more on those here: https://doc.sitecore.com/users/sxa/93/sitecore-experience-accelerator/en/sxa-search-facets,-scopes,-and-tokens.html

You could use the same computed field for the scope(s) - but for scopes you probably won't need it. You are able to define the scopes easily based upon the location and/or the template. Your editor should pick the scope in the search result component.

  • Hey hi this approach is good one but issue is how can we limit the facet based on datasource field, like how can we make configurable facet to show facet field based on tree node selection. Which approach you are telling in that we list out all the page templates but we need the flexibility to Content author to display specific node children and that must be configurable. May 9, 2021 at 5:26
  • Added an update to the answer - you need a scope to do what you want, not a facet.
    – Gatogordo
    May 9, 2021 at 8:52
  • They need somehow similar functionality of scope in term of facet so in web page they can change the behavior or scope of search, anyways that computed filed approach was great let me implement that and need to dig more into it. Big thanks May 11, 2021 at 14:27
  • No problem - don't forget to mark the answer as accepted if it helped to solve your issue ;)
    – Gatogordo
    May 11, 2021 at 14:29

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.