Try our conversational search powered by Generative AI!

EpiFind: search only on parents children



I am trying to make a search result, with Find, with rsults only from currentpage and its children. I would like somthing like FilterOnCurrentSite() but for only currentpage and its children. Does anyone know hos I can do this?


search = search
.TermsFacetFor(arr => arr.MainL, facetRequest =>
facetRequest.AllTerms = true;
facetRequest.Size = MaxFacets;
.TermsFacetFor(arr => arr.CNames, facetRequest =>
facetRequest.AllTerms = true;
facetRequest.Size = MaxFacets;

Apr 06, 2017 10:31

You should be able to do that with: 

.Filter(x => x.Ancestors().Match("insertcurrentpageid"))
Apr 06, 2017 10:44

Hi, you can use 

.Filter(x => x.Ancestors().Match(currentPage.ContentLink.ToString())

Edit: Looks like Erik already answered that :-)

Edited, Apr 06, 2017 10:47

Yes I have tried it but i do not get the right result. Maybe there is something else wrong.

Apr 06, 2017 10:48


If you want to use the Ancestors() extension, you probably need to make sure you're not searching on a reference with a work id as well. So also add ToReferenceWithoutVersion()! That might be the reason why it's not working now.

.Filter(x => x.Ancestors().Match(currentPage.ContentLink.ToReferenceWithoutVersion().ToString())
Apr 06, 2017 13:41

Perfect its working for Pages , Can anybody have idea how can we get Blocks as well please..

Jul 20, 2018 11:04
* 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.