Unified Search Index Projection Not Working at all


Hi, I am trying to customize the index projection for unified search like below

              .ForInstanceOf().ProjectTitleFrom(s => s.Position);

But i have noticed after several days of debugging that below code in EPiServer.Find.Cms.CmsClientConventions

client.Conventions.ForInstancesOf().IncludeField((Expression>) (x => x.ContentLink)).IncludeField((Expression>) (x => x.GetTimestamp())).IncludeField((Expression>) (x => x.SiteId())).IncludeField((Expression>) (x => x.ContentTypeName())).IncludeField((Expression>) (x => x.Ancestors())).IncludeField>((Expression>>) (x => x.PublishedInLanguage())).IncludeField((Expression>) (x => x.CommonName())).IncludeField((Expression>) (x => x.CommonType())).IncludeField((Expression>) (x => x.CommonTypeShortName())).IncludeField((Expression>) (x => x.CommonTypeDisplayName())).IncludeField((Expression>) (x => x.SearchTitle())).IncludeField((Expression>) (x => x.SearchText())).IncludeField((Expression>) (x => x.SearchSection())).IncludeField((Expression>) (x => x.SearchSubsection())).IncludeField((Expression>) (x => x.HasTemplate())).IdIs((Func) (x => (DocumentId) x.GetIndexId())).ExcludeField("__interceptors").ExcludeFieldMatching((Func) (prop => typeof (XForm).IsAssignableFrom(prop.PropertyType))).ExcludeFieldMatching((Func) (prop => typeof (PageType).IsAssignableFrom(prop.PropertyType))).ExcludeFieldMatching((Func) (prop => typeof (Url).IsAssignableFrom(prop.PropertyType))).ExcludeFieldMatching((Func) (prop => typeof (LinkItemCollection).IsAssignableFrom(prop.PropertyType)));

always takes the precedence. I think the only way to override the SearchTitle/SearchSection is to provide the extension method not through the unified registry?

Any comments regarding this?

Edited, Apr 10, 2018 2:12

It's easier if you reuse one of the property names of ISearchContent:

If I understand your question you could just add a SearchTitle property that returns this.Position.

Then you can also inspect the index and see what's there.

Apr 14, 2018 23:22

Hi Johan,

I am doing following way 

First I am removing existing field which was added in EPiServer.Find.Cms.CmsClientConventions

                .ExcludeField(p => p.SearchSection());

and then I have added my own function as extension method for individual class

  public static string SearchSection(this PlayerPage content)
            return content.Position;

and then added in unified registry

                .IncludeField(p => p.SearchSection());

but the questions is if the below feature does not work then why it is ther?

              .ForInstanceOf().ProjectTitleFrom(s => s.Position);
Apr 16, 2018 3:06
* 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.