Including fields setter issue

Vote:
 

Hi,

We faced with issue in customizing the Client conventions. We add custom type (not EPiServer content item) to EPiServer Find Index.

Configuration:

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(p => p.Id())
                .IncludeField(p => p.Name())
                .IncludeField(p => p.SearchTitle())
                .IncludeField(p => p.SearchSection())
                .IncludeField(p => p.SearchSubsection())
                .IncludeField(p => p.SearchMetaData())
                .IncludeField(p => p.SearchHitUrl(), BusinessExtension.SetSearchHitUrl);
        public static class BusinessExtension
        {
            public static void SetSearchHitUrl(BaseTool.Business.Data.Models.Business value, string text)
            {

            }

            public static string SearchHitUrl(this BaseTool.Business.Data.Models.Business value)
            {
                return "SearchHitUrl " + value.Id();
            }
        }

SearchHitUrl calls during indexation process.

SetSearchHitUrl method is never called during MultiUnifiedSearch or UnifiedSearch.

Is it possible to automatically change property value during GetResult() operation?

Best regards,

Pavel

Documentation: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Customizing-serialization/Including-fields/

#142793
Dec 24, 2015 11:21
Vote:
 

Hi,

Unified search is a bit of a special case. Normally when querying you index and search for a common type, i.e you index Business and query for Business (or som inherited parent type or interface). In this case your query will know every type that it should apply it's convention rules for. However for unified search you don't query for Business types but insted query for the generic ISearchContent that in the result will be mapped to UnifiedSearchHit. This result mapping don't t look for conventions for the 'original' types but instead follows conventions for unified search. The api don't allow for automatically changing the property value in GetResult for UnifiedSearchHit so you best take at the moment is to iterate the result 'manually'.

#143106
Jan 12, 2016 15:44
* 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.