November Happy Hour will be moved to Thursday December 5th.

How can I create a "category" Facet based on the parent page.

Vote:
 

I've got a heirarchy of pages such as 

- Root
   - Category 1
        - Page 1
        - Page 2
   - Category 2
       - Page 3


I want to use Find to create a filter based on the Category page names. Here's what I've got so far, the bit I can't figure out is line 4

ar result = _searchClient.Search()
                                      .For(query)
                                      .Filter(x => x.Ancestors().Match(rootPageLink.ID.ToString()))
                                      .FilterFacet("Categories", x => x.ParentLink) // This doesn't work
                                      .HistogramFacetFor(x => x.Price, 100)
                                      .Skip((pageNumber - 1) * pageSize)
                                      .Take(pageSize)
                                      .GetContentResult();

Obviously this doesn't work because Filter() expects a Filter as the second argument but you can see what I'm trying to do.  It's roughly analagous to a SQL `GROUP BY ParentLink` and then display info like

Category 1 (2 pages)

Category 2 (1 page)

 

#173832
Edited, Jan 10, 2017 17:54
Vote:
 

How about TermsFacetFor(x => x.ParentLink) ?

http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Searching/Facets/Terms-facets/

#173901
Jan 12, 2017 12:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.