Get results from epi server find query under specific page


Hi ,

I have been tring to get search results under specific page(parent page) uisng unified search query, able to get pages (respective parent page) and all media document irrespective of parent page. So I need to finter the document with parent page.


Page and under that page we will have content area may accept  AssociatedDocumentItem (It will contain the document property accept only generic media(Media type)).

When I do search I am able to get Icontent(Pages and documents), but I am not able to find out  relation between document to  AssociatedDocumentItem and Page i.e. document parentbpage 

Below is my query.

 searchQry = searchQry.Filter(x => !x.MatchTypeHierarchy(typeof(SitePageData)) | ((SitePageData)x).Ancestors().Match(parentId)); -- getting all documents and pages under parent. Not able to apply Ancestors().Match for documents.



Aug 22, 2018 10:31

I hate to recommend this approach but in this case you may have to call get content references for each document:

Aug 22, 2018 21:16

You could filter by ancestors. Example: 

SearchClient.Instance.Search<IContent>().Filter(x => x.Ancestors().Match(ContentReference.StartPage.ToString());


Aug 24, 2018 20:36

Hi Aniket,

Thanks for your suggestion, I have used same in published  event for all media types and now could able filter docuemnst under specific page

Sep 06, 2018 16:11

Thank Frederik Vig.

Yeah, but it will work for only pages not for documents. 

Sep 06, 2018 16:13
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.