Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Try something like this
SearchClient.Instance.UnifiedSearch()
.Filter(x => ((InfoPage)x).Ancestors().Match(currentPage.PageLink.ToString()))
.Filter(x => x.SearchTitle("foresatte"))
.GetResult()
You can also project the Search Title from any property i.e.
.ProjectTitleFrom(x => x.Name);
I assume you meant Search and Navigation. You can simply add this
public static IEnumerable<string> AncestorNames(this IContent content)
{
return _contentLoader.GetAncestors(content.ContentLink.ToReferenceWithoutVersion()).Select(x => x.Name);
}
then include it in your convention then use in your query.
Hello.
I am trying to write a query where I want to search that if any of the ancestors has a particular name. I wrote this but doesn't work
query = query.Filter(i => ( !i.MatchTypeHierarchy(typeof(InfoPage)) | _contentLoader.GetAncestors(((InfoPage)i).ContentLink).MatchItem(k => k.Name.Match("foresatte")) ) );
I tried this as well
query = query.Filter(i => ( !i.MatchTypeHierarchy(typeof(InfoPage)) | _contentLoader.GetAncestors(((InfoPage)i).ContentLink).MatchContainedCaseInsensitive(k => k.Name, "foresatte") ) );
When I do this
Then I get back ids, but I want page name to search on.