Epi Find unified search "two page headers" problem

Vote:
 

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:

      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.

#195155
Jul 16, 2018 14:24
Vote:
 

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/

#195218
Jul 17, 2018 22:56
* 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.