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,
What happens if you change the type from an interface to a concrete implementation of list?
IList<string> ---> List<string>
I am indexing pages which have a base class with an IList<string> property like below:
public virtual IList<string> TagCodes
{
get { return new List<string> { "Shoulder", "Knee", "Video" }; }
}
It gets indexed correctly and looks as following when I do index view:
"TagCodes": [ "Shoulder", "Knee", "Video" ],
However, when I perform the actual search I am getting the following exception "To deserialize objects the $type property must be set.". I am a bit at loss at what is happening and what I am missing.
_searchClient
.Search<ExpertBaseResourcePageType>()
.Select(p => new SearchResultItem
{
TagCodes = p.TagCodes
} as ISearchResultItem)
.GetResult();
Below is exception stack trace as well:
at EPiServer.Find.ProjectionHelper.DeserializeObject(JToken root)
at EPiServer.Find.ProjectionHelper.AddPartialFields(SearchRequestBody requestBody, SearchHit`1 searchHit, Dictionary`2 args)
at EPiServer.Find.ProjectionHelper.GetFieldValues(SearchRequestBody requestBody, SearchHit`1 searchHit)
at EPiServer.Find.ProjectionHelper.GetMappedSearchResultItem[TResult](SearchRequestBody requestBody, SearchHit`1 searchHit)
at EPiServer.Find.ProjectionHelper.GetMappedResult[TResult](SearchRequestBody requestBody, SearchResults`1 jsonResult)
at EPiServer.Find.SearchExtensions.GetProjectedResult[TResult](ISearch`1 search, SearchContext context)
at EPiServer.Find.SearchExtensions.GetResult[TResult](ISearch`1 search)