Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Episerver Find Convention Include Setter Ignore

Vote:
 

Hi,

I have no issues in adding fields so that they get indexed properly in Find and usable for filtering/sorting etc...

Now for performance reasons (The example bellow is a simple example) I would like that returned search results be directly hydrated from the Find Search result.

The conventions:

protected void ApplyNodeContentConventions(EPiServer.Find.ClientConventions.TypeConventionBuilder<FoodNode> conventionBuilder)
        {
            //Add custom field to search index            
            conventionBuilder.IncludeField(x => x.DefaultImageUrl(), (x, value) => x.SetDefaultImage(value)); 
        } 

The Search Query:

            var resultsN = _findClient.Search<FoodNode>().PublishedInCurrentLanguage()
                                                        .Filter(i => i.DefaultImageUrl().Exists())
                                                        .Take(1000)
                                                        .GetResult<FoodNode>()
                                                        ?.ToList();

The Setter is never called when the results return. (I tried with GetContentResult without success)
This gives performance issue because for each results I now have to call the asset loader... I think it could be avoided since the DefaultImageUrl is part of the Find result payload.

I followed the documentation from here: https://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/9/DotNET-Client-API/Customizing-serialization/Including-fields/ 

#201140
Feb 06, 2019 19:30
* 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.