public void DefineMaps(UmbracoMapper mapper)
        {
            mapper.Define <ISearchResult, IPublishedContent>((source, context) => _publishedContentHelper.GetByString(source.Id));

            mapper.Define <string, IPublishedContent>((source, context) => _publishedContentHelper.GetByString(source));

            mapper.Define <Guid, IPublishedContent>((source, context) => _publishedContentHelper.GetByGuid(source));

            mapper.Define <Udi, IPublishedContent>((source, context) => _publishedContentHelper.GetByUdi(source));
        }
예제 #2
0
        protected override void AddSingleValue(Document doc, object value)
        {
            base.AddSingleValue(doc, value);

            if (value is string valueString)
            {
                var ids = valueString.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var id in ids)
                {
                    var content = _publishedContentHelper.GetByString(id);

                    if (content != null)
                    {
                        if (content.UrlSegment != null)
                        {
                            doc.Add(new Field(FieldName, content.UrlSegment, Field.Store.NO, Field.Index.NOT_ANALYZED));
                        }
                    }
                }
            }
        }