November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi Sam,
If you added a property to your type similar to this:
public virtual string SearchSummary => base.ListingSynopsis;
And keeping the projection as you have it, I would expect that to work as you want.
Explained further here, under ISearchContent:
Hope it helps.
Paul
Thanks @Paul Middleton that was exactly what i was after. What's great is that if the SearchSummary property returns an empty string epi Find will fall back to the normal excerpt which is what the client wanted. perfect!
I am trying to update an episerver website so that the text shown in the excerpt comes from a specific property that is used on all page types of the site. We have a base page type called BaseRenderedPage that has a property named ListingSynopsis which is used throughout the site when rendering a list of pages (such as on a section landing page). We would like this property to be the text shown for each search result listed on the site search page. Currently we are using unified search and the text used is the Excerpt. I am aware that there is a way to ‘project’ the excerpt using the following code but it is not working as I need it to.
SearchClient.Instance.Conventions.UnifiedSearchRegistry
.ForInstanceOf<BaseRenderedPage>()
.ProjectExcerptUsing<ISearchContent>(spec =>
x => x.SearchTitle);
The problem I have is I can’t work out how to make the text of the excerpt the property on my base page type, the only examples I can see are to make the excerpt come from a property on the ISearchContent itself rather than from a property on the type of content that the UnifiedSearchHit points to.
Is it actually possible to do what I am trying using episerver find? The only alternative I can think of would be to try to convert each search result into an instance of BaseRenderedPage when I get the results back and then I could output the required text directly but I think this would reduce the efficiency of the code considerably.