AI OnAI Off
You should be able to do that with:
.Filter(x => x.Ancestors().Match("insertcurrentpageid"))
Hi, you can use
.Filter(x => x.Ancestors().Match(currentPage.ContentLink.ToString())
Edit: Looks like Erik already answered that :-)
Yes I have tried it but i do not get the right result. Maybe there is something else wrong.
Hi,
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())
Perfect its working for Pages , Can anybody have idea how can we get Blocks as well please..
Hi!
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?
Code:
search = search
.ExcludeDeleted()
.CurrentlyPublished()
.FilterOnCurrentSite()
.TermsFacetFor(arr => arr.MainL, facetRequest =>
{
facetRequest.AllTerms = true;
facetRequest.Size = MaxFacets;
})
.TermsFacetFor(arr => arr.CNames, facetRequest =>
{
facetRequest.AllTerms = true;
facetRequest.Size = MaxFacets;
});