public List<string> GetSelectedItems(CustomTreeListField field)
        {
            // Return a list with an empty guid so we can search via Solr for unmapped fields
            if (!field.ListItems.Any())
            {
                return new List<string>() { 
                    IdHelper.NormalizeGuid(ID.Parse(Guid.Empty)) 
                };
            }

            var query = from i in field.ListItems
                         select IdHelper.NormalizeGuid(i.ID);

            return query.ToList();
        }
        public List <string> GetSelectedItems(CustomTreeListField field)
        {
            // Return a list with an empty guid so we can search via Solr for unmapped fields
            if (!field.ListItems.Any())
            {
                return(new List <string>()
                {
                    IdHelper.NormalizeGuid(ID.Parse(Guid.Empty))
                });
            }

            var query = from i in field.ListItems
                        select IdHelper.NormalizeGuid(i.ID);

            return(query.ToList());
        }
        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexItem = indexable as SitecoreIndexableItem;

            if (indexItem == null)
            {
                return(null);
            }
            var item = (Sitecore.Data.Items.Item)indexItem.Item;

            if (item == null)
            {
                return(null);
            }

            // Skip non-events
            if (!item.InheritsTemplate(BaseEventDetailPageItem.TemplateId))
            {
                return(null);
            }

            var  eventPage             = new BaseEventDetailPageItem(item);
            bool fieldMatch            = true;
            CustomTreeListField target = null;

            // Only index the following fields
            switch (FieldName)
            {
            case UnderstoodDotOrg.Common.Constants.SolrFields.EventGrades:
                target = eventPage.Grade;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.EventIssues:
                target = eventPage.ChildIssue;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.EventTopics:
                target = eventPage.ParentInterest;
                break;

            default:
                fieldMatch = false;
                break;
            }

            return(fieldMatch ? GetSelectedItems(target) : null);
        }
Example #4
0
        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexItem = indexable as SitecoreIndexableItem;

            if (indexItem == null)
            {
                return(null);
            }
            var item = (Sitecore.Data.Items.Item)indexItem.Item;

            if (item == null)
            {
                return(null);
            }

            // Skip non-behavior articles
            if (!item.InheritsTemplate(BehaviorAdvicePageItem.TemplateId))
            {
                return(null);
            }

            var  article               = new BehaviorAdvicePageItem(item);
            bool fieldMatch            = true;
            CustomTreeListField target = null;

            // Only index the following fields
            switch (FieldName)
            {
            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildChallenges:
                target = article.ChildChallenges;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildBehaviorGrades:
                target = article.ChildGrades;
                break;

            default:
                fieldMatch = false;
                break;
            }

            return(fieldMatch ? GetSelectedItems(target) : null);
        }
        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexItem = indexable as SitecoreIndexableItem;

            if (indexItem == null)
            {
                return(null);
            }
            var item = (Sitecore.Data.Items.Item)indexItem.Item;

            if (item == null)
            {
                return(null);
            }

            // Skip non-articles
            if (!item.InheritsTemplate(DefaultArticlePageItem.TemplateId))
            {
                return(null);
            }

            var  article               = new DefaultArticlePageItem(item);
            bool fieldMatch            = true;
            CustomTreeListField target = null;

            // Only index the following fields
            switch (FieldName)
            {
            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildDiagnoses:
                target = article.ChildDiagnoses;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildGrades:
                target = article.ChildGrades;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ChildIssues:
                target = article.ChildIssues;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ApplicableEvaluations:
                target = article.OtherApplicableEvaluations;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.DiagnosedConditions:
                target = article.DiagnosedCondition;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ImportanceLevels:
                target = article.ImportanceLevel;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.OverrideTypes:
                target = article.OverrideType;
                break;

            case UnderstoodDotOrg.Common.Constants.SolrFields.ParentInterests:
                target = article.ApplicableInterests;
                break;

            default:
                fieldMatch = false;
                break;
            }

            return(fieldMatch ? GetSelectedItems(target) : null);
        }