We are running unified search with episerver find version 12.4.1.
We have pages with two different "headers". The first one is the default episerver name for Page "PageName".
The other header is a Property on the PageBase Abstract class named "Title".
The functionality we want is the following:
If "Title" exists show that in the Search Result for "SearchTitle".
If "Title" not exist show "PageName" as "SearchTitle".
BUT both "PageName" and "Title" is searachable and boosted so it acts like a SearchTitle.
A page has the following values:
PageName = "An advanced CMS"
Title = "About Episerver"
And you search for advanced CMS:
The title in search result will be the "About Episerver" and it will be boosted as the first hit.
If you search for About Episerver it will have standard behaviour ofcourse.
Title = null
Search for CMS:
The title in search result will be the "An advanced CMS".
Solutions we have tried:
In PageBase have the following values:
public string SearchTitle
public string GetConditionalPageTitle()
return Title.IsNotNullOrEmpty() ? Title : PageName;
And in FindInitialization module have these:
.IncludeField(x => x.GetConditionalPageTitle());
.ProjectTitleFrom(x => x.GetConditionalPageTitle());
But it does not work. Both headers are shown in this way, and they do not get the same boost as before.
The docs have ISearchContent members as virtual in the code sample. Not sure if it matters.