AI OnAI Off
I hate to recommend this approach but in this case you may have to call get content references for each document: https://www.dcaric.com/blog/episerver-9-references-to-content
You could filter by ancestors. Example:
SearchClient.Instance.Search<IContent>().Filter(x => x.Ancestors().Match(ContentReference.StartPage.ToString());
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
Thank Frederik Vig.
Yeah, but it will work for only pages not for documents.
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.
Scenario:
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.
Regards,
Narayana