Showing XhtmlString in Highlighted Excerpt

Vote:
 

Hi,

To show properties of type string in Highlighted Excerpt I am using below code:

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf()
                .ProjectHighlightedExcerptUsing(spec =>
                    x => x.Recipe_Short_Description);

Similarly to show XhtmlString in Highlighted Excerpt I am using

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf()
                .ProjectHighlightedExcerptUsing(spec =>
                    x => x.Secret_Description.ToString());

But the above display Excerpt as blank. How can I resolve it?

Thanks
Pankaj

#122509
Jun 03, 2015 15:28
Vote:
 

In short, how can I convert XhtmlString to string.

Thanks

#122795
Jun 14, 2015 9:03
Vote:
 
Hi Pankaj,
Try this:-

//instruct the SearchClient to pull the Excerpt from the Secret_Description field
SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<OurSecretDetailsPage>()
.ProjectExcerptUsing<OurSecretDetailsPage>(specification => x => x. Secret_Description);

 //instruct the SearchClient to pull the highlighted Excerpt from the Secret_Description field 
 SearchClient.Instance.Conventions.UnifiedSearchRegistry
            .ForInstanceOf<OurSecretDetailsPage>()
            .ProjectHighlightedExcerptUsing<OurSecretDetailsPage>(
                    specification =>
                       x =>
                          x.Secret_Description.AsHighlighted(
                            new HighlightSpec
                          {
                              PreTag = "<span style=\"\">",
                              PostTag = "</span>"
                          }));
            }
Cheers,
Naz
#123379
Edited, Jul 02, 2015 16:45
* 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.