Automatic type conversion might not work for the IEnumerable<T> type when mapping index document fields to properties. An example of the affected properties looks like this:
public class MySearchItem { [IndexField("treelist")] public IEnumerable<Guid> TreeList { get; set; } [IndexField("multilist")] public IEnumerable<ID> MultiList{ get; set; } }
In this case, the TreeList and MultiList properties remain unassigned (null) even if the search result includes a valid value in the "treelist_sm" and "multilist_sm" field.
To resolve the issue, consider one of the following options:
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/"> <sitecore role:require="Standalone or ContentManagement or ContentDelivery" search:require="solr"> <contentSearch> <indexConfigurations> <defaultSolrIndexConfiguration> <fieldMap> <typeMatches hint="raw:AddTypeMatch"> <typeMatch typeName="guidEnumerable" type="System.Collections.Generic.IEnumerable`1[System.Guid]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" /> <typeMatch typeName="idEnumerable" type="System.Collections.Generic.IEnumerable`1[[Sitecore.Data.ID, Sitecore.Kernel]]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" /> </typeMatches> </fieldMap> </defaultSolrIndexConfiguration> </indexConfigurations> </contentSearch> </sitecore> </configuration>
public class MySearchItem { [IndexField("treelist")] public List<Guid> TreeList { get; set; } [IndexField("multilist")] public List<Guid> MultiList{ get; set; } }