Gravatar for djansse@gmail.com

Question by djanssen, Sep 19, 2017 10:05 PM

Is it possible to group results together that are under a common topic?

How can I implement group by functionality on the search results page? And then can there be nested group by results?

I have a flat tree of sitecore items that all contain a "Book" and "Chapter" field that we are looking to group by (first by book, then my chapter).

I was looking into the folding functionality, and from my research, it sounds like a hierarchy of parent-child needs to be set up in order for this to work. Is this something I can accomplish if I bucket the items?

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Sep 20, 2017 10:45 AM

You could use the dependsOn option on the Coveo Facet component.

You simply add a Coveo facet for Book and then another one for Chapter. The Chapter facet will appear only when one or more book is selected.
Facets are what is call group by under the hood, but I don't think it is optimal for your use case.

The folding functionality would indeed be something great to use. You will indeed need to set up a kind of hierarchy to use this feature. You can easily implement this hierarchy with your Sitecore templates or by adding computed fields. You will need to ensure that your items have the required fields and it should work. I would suggest reading the documentation and trying to implement it with some dummy items as this is a concept that might be difficult to grasp the first time somebody uses it.

> Is this something I can accomplish if I bucket the items?

Yes, Coveo for Sitecore indexes bucket items. As long as you can find them in your index, you can implement folding on them.

Ask a question