Try our conversational search powered by Generative AI!

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


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()
                                      .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)

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)


Edited, Jan 10, 2017 17:54

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

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.