Projecting ContentReference on GetResult


Hi all,

I'm using EpiServer Find v12.3.2.0 and I have a problem with projections. Code is

return query.Select(a => new SearchHit
                    Title = a.DisplayName,
                    Description = a.Description,
                    ImageLink = a.ImageLink,
                    Link = a.ContentLink

and the SearchHit class is

    public class SearchHit
        public string Title { get; set; }
        public string Description { get; set; }
        public string Details { get; set; }
        public ContentReference Link { get; set; }
        public ContentReference ImageLink { get; set; }

So I thought the problem here is the ContentReference itself. Then I tried to create a intermediate type with Id, WorkId, and ProviderName. That lead to same error which is

EPiServer.Find.ProjectionException: An exception of type JsonSerializationException was thrown while deserializing object. ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'EPiServer.Find.Cms.IndexableContentReference' because the type requires a JSON string value to deserialize correctly. To fix this error either change the JSON to a JSON string value or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'IsExternalProvider$$bool', line 1, position 30.

I have two questions. First, is this a problem related to data on index? (which I think more likely because also projecting to a intermediate class with primitive types is resulting in same error). If not, here comes my second question: is it allowed to project ContentReference type on GetResult?

Thanks in advance,


Edited, Sep 27, 2018 16:34
* 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.