Correct. Sitecore and Solr don't have a field type to map a collection or an array of doubles or floats.
These are the available multiValued
field types automatically matched by Sitecore:
<typeMatch typeName="guidCollection" type="System.Collections.Generic.List`1[System.Guid]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="textCollection" type="System.Collections.Generic.List`1[System.String]" fieldNameFormat="{0}_txm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="stringCollection" type="System.Collections.Generic.List`1[System.String]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="intCollection" type="System.Collections.Generic.List`1[System.Int32]" fieldNameFormat="{0}_im" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="stringArray" type="System.String[]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="intArray" type="System.Int32[]" fieldNameFormat="{0}_im" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="datetimeArray" type="System.DateTime[]" fieldNameFormat="{0}_dtm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
<typeMatch typeName="datetimeCollection" type="System.Collections.Generic.List`1[System.DateTime]" fieldNameFormat="{0}_dtm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
You will need to implement the following steps to define a new custom multiValued
field type for a double collection and apply it to your computed field:
- You need to define a new custom dynamicField in your index
managed-schema.xml
file:
<dynamicField name="*_tdm" type="pdouble" multiValued="true" indexed="true" stored="true"/>
- Then you will need to patch the
typeMatches
defined in the Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
to add a new custom typeMatch:
<typeMatch typeName="doubleCollection" type="System.Collections.Generic.List`1[System.Double]" fieldNameFormat="{0}_tdm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
- And finally you will need to use this new type in the definition of your computed field in the
returnType
property, in both following sections of your index configuration. For example:
<fields hint="raw:AddComputedIndexField">
<field fieldName="myDoubleCollectionField" returnType="doubleCollection">MyAssembly.CustomComputedField,MyAssembly</field>
</fields>
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="myDoubleCollectionField" returnType="doubleCollection" />
</fieldNames>