title: Custom Sitecore Solr index computed field returning wrong value
body: <p>I have a computed field called Terms. This field reads the list of guid values that Sitecore stores the multilist field as, into a comma separated string of values. When I trigger an index rebuild and set a breakpoint, I can see the code performing the task as expected, but for some reason, in the index the value is still being stored as an array of guid strings. I don't know where the disconnect is. </p>
  
  <p>Checking Solr and configuring the query to return xml, I can see the terms field being stored like so:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;arr name="terms_t"&gt;
    &lt;str&gt;b7ba58ef002b4554808a1d423ca574d8&lt;/str&gt;
    &lt;str&gt;95680bf346d142aeb0d8f189300ea3f2&lt;/str&gt;
  &lt;/arr&gt;
  </code></pre>
  
  <p>Below You can see the class used to populate the computed field</p>
  
  <pre class="lang-cs prettyprint-override"><code>namespace ASHPEngine.ComputedFields
  {
      public class Terms : Sitecore.ContentSearch.ComputedFields.IComputedIndexField
      {
          public object ComputeFieldValue(IIndexable indexable)
          {
              Assert.ArgumentNotNull(indexable, "indexable");
              var scIndexable = indexable as Sitecore.ContentSearch.SitecoreIndexableItem;
              if (scIndexable == null)
              {
                  return false;
              }
              if (String.Compare(scIndexable.Item.Database.Name, "core", System.StringComparison.OrdinalIgnoreCase) == 0)
              {
              return false;
          }
          if (!scIndexable.Item.InheritsFrom(IBaseArticleConstants.TemplateName)) return String.Empty;
          var termsField = scIndexable.GetFieldByName(INewsConstants.TermsFieldName);
          {
              var retval = new StringBuilder();
              var terms = termsField.Value.ToString().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();
              foreach (var id in terms)
              {
                  var termItem = scIndexable.Item.Database.GetItem(new ID(id));
                  retval.Append(termItem.Name + ", ");
              }
  
              return retval.Length &gt; 0 ? retval.Remove(retval.Length-2, 2).ToString() : string.Empty;
          }
      }
  
      public string FieldName { get; set; }
      public string ReturnType { get; set; }
  }
  </code></pre>
  
  <p>And the configuration:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt;
   &lt;sitecore&gt;
      &lt;contentSearch&gt;
        &lt;configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch"&gt;
  
      &lt;indexes hint="list:AddIndex"&gt;
        &lt;index id="news" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider"&gt;
          &lt;param desc="name"&gt;$(id)&lt;/param&gt;
          &lt;param desc="folder"&gt;$(id)&lt;/param&gt;
  
          &lt;!-- This initializes index property store. Id has to be set to the index id --&gt;
          &lt;param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" /&gt;
  
          &lt;configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration"&gt;
  
  
            &lt;fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap"&gt;
  
              &lt;fieldNames hint="raw:AddFieldByFieldName"&gt;
                &lt;field fieldName="_uniqueid" returnType="string" /&gt;
                &lt;field fieldName="article" returnType="string" /&gt;
                &lt;field fieldName="author" returnType="string"/&gt;
                &lt;field fieldName="author credentials" returnType="string" /&gt;
                &lt;field fieldName="date" returnType="datetime" format="yyyy-MM-dd'T'HH:mm:ss'Z'" /&gt;
                &lt;field fieldName="degree" returnType="string" /&gt;
                &lt;field fieldName="graduation year" returnType="string" /&gt;
                &lt;field fieldName="location" returnType="string" /&gt;
                &lt;field fieldName="navigation title" returnType="string" /&gt;
                &lt;field fieldName="page abstract" returnType="string" /&gt;
                &lt;field fieldName="school" returnType="string" /&gt;
                &lt;field fieldName="text" returnType="string" /&gt;
                &lt;field fieldName="value" returnType="string" /&gt;
              &lt;/fieldNames&gt;
            &lt;/fieldMap&gt;
            &lt;documentOptions ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/documentOptions"&gt;
  
              &lt;fields hint="raw:AddComputedIndexField"&gt;
                &lt;field fieldName="external_link" returnType="text"&gt;mydll.ComputedFields.ExternalLink, mydll&lt;/field&gt;
                &lt;field fieldName="image" returnType="text"&gt;mydll.ComputedFields.Image, mydll&lt;/field&gt;
                &lt;field fieldName="terms" returnType="text"&gt;mydll.ComputedFields.Terms, mydll&lt;/field&gt;
                &lt;field fieldName="url" returnType="text"&gt;mydll.ComputedFields.Url, mydll&lt;/field&gt;
                &lt;field fieldName="parentname" returnType="text"&gt;mydll.ComputedFields.ParentName, mydll&lt;/field&gt;
              &lt;/fields&gt;
            &lt;/documentOptions&gt;
  
          &lt;/configuration&gt;
  
          &lt;strategies hint="list:AddStrategy"&gt;
            &lt;!-- NOTE: order of these is controls the execution order --&gt;
            &lt;strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" /&gt;
          &lt;/strategies&gt;
  
          &lt;locations hint="list:AddCrawler"&gt;
            &lt;crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch"&gt;
              &lt;Database&gt;web&lt;/Database&gt;
              &lt;Root&gt;/sitecore/content&lt;/Root&gt;
            &lt;/crawler&gt;
          &lt;/locations&gt;
  
          &lt;enableItemLanguageFallback&gt;false&lt;/enableItemLanguageFallback&gt;
          &lt;enableFieldLanguageFallback&gt;false&lt;/enableFieldLanguageFallback&gt;
  
        &lt;/index&gt;
      &lt;/indexes&gt;
    &lt;/configuration&gt;
    &lt;/contentSearch&gt;
    &lt;/sitecore&gt;
  &lt;/configuration&gt;
  </code></pre>