London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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 }) .GetResult();
and the SearchHit class is
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,
Tarik.