Hello!
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.
Examples:
A page has the following values:
Scenario 1
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.
Scenario 2
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 { get { return string.Join( " ", new string[] { Title, PageName }); } } public string GetConditionalPageTitle() { return Title.IsNotNullOrEmpty() ? Title : PageName; }
And in FindInitialization module have these:
SearchClient.Instance.Conventions.ForInstancesOf() .IncludeField(x => x.GetConditionalPageTitle()); SearchClient.Instance.Conventions.UnifiedSearchRegistry .ForInstanceOf() .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.
https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/Unified-search/
Hello!
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.
Examples:
A page has the following values:
Scenario 1
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.
Scenario 2
PageName = "An advanced CMS"
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:
And in FindInitialization module have these:
But it does not work. Both headers are shown in this way, and they do not get the same boost as before.