Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Get UnifiedSearchHit descendants of PageID


I know its possible to filter searchresults using siteID in an enterprise solution, but is it possible to filter for descendants of a pageID?

As of now I'm running a method on the resultset, filtering out those PageData objects which are not a descendant of a given pageID.

Apr 03, 2013 9:28

Given that you are using EPiServer 7 it is. For EPiServer 6 I don't think it is out of the box although it's quite easy to fix (the Ancestors method used below will need to be added).

Anyway, given EPiServer 7 and using Unified Search (the syntax would be prettier when using "regular" search):

    .Filter(x => 
        | ((PageData)x).Ancestors().Match(ContentReference.StartPage.ToString()))


Edited, Apr 03, 2013 9:50

I am trying to achieve this on an Epi 6 R2 site. How would the Ancestors method look like? I can't get it working with it returning a List<string> containing PageReferences (id's) that are made to strings. I'm also having a breakpoint in the extension method but it never hits, so can't figure out if it's even ran. 

Apr 30, 2015 13:42

"Ancestors" would need to be a JSON property if you browse your Index in the Find plugin views. Are you seeing it?

Jun 05, 2015 9:06

Is this currently the way get matches below a certain page? Seems to work, but I had to change:




Becase I guess it is the page id we want there, and sometimes it's prefixed by and underscore and workpageid(?)

Sep 30, 2015 10:15
* 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.