0

I am implementing _Semantics field in the Solr index

<fieldNames hint="raw:AddFieldByFieldName">
   <field fieldName="customtags"  returnType="text" />
</fieldNames>
                    
<fields>
   <field fieldName="customtags"> RET.Web.Areas.LLRET.Compute.CustomTags,RET.Web</field>
</fields>

 public class CustomTags : IComputedIndexField
    {
        public virtual ID TagsSelector { get; set; }

        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexableItem = indexable as SitecoreIndexableItem;

            return indexableItem == null || TagsSelector.IsNull ? null : indexableItem.Item.GetMultiListValues(TagsSelector).Select(tag => tag.Name).ToList();
        }

        public string FieldName { get; set; }
        public string ReturnType { get; set; }
    }
    
    
    public static class HelperMethods
    {
        public static IEnumerable<Item> GetMultiListValues(this Item item, ID fieldId)
        {
            return (new MultilistField(item.Fields[fieldId])).GetItems();
        }
    }

What should be the return type for the customtags

Should it be Text or String or StringCollection

Is this a correct way of implementing the _Semantics tagging into solr

Any help or suggestion would be appreciated.

Thanks in advance

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.