Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »


DAM for Optimizely works well with Optimizely Find. To get the most out of it you might want to even add the individual assets to the index. This can be done by adding a ReindexInformation provider as shown below.

ReindexInformation Provider
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using EPiServer;
using EPiServer.Core;
using EPiServer.Find.Cms;
using EPiServer.ServiceLocation;
using EPiServer.Web;

namespace Digizuite.Episerver.Examples.Find
{
    [ServiceConfiguration(typeof(IReindexInformation), Lifecycle = ServiceInstanceScope.Singleton)]
    public class DigizuiteReindexInformation : IReindexInformation
    {
        public IContentLoader ContentLoader { get; set; }

        public IDigizuiteClient Client { get; set; }

        public DigizuiteReindexInformation(IContentLoader contentloader, IDigizuiteClient client)
        {
            this.ContentLoader = contentloader;
            this.Client = client;
        }

        public virtual IEnumerable<ReindexTarget> ReindexTargets
        {
            get
            {
                if (Client.Folders == null)
                    return new List<ReindexTarget>();

                var contentLinks = new List<ContentReference>();
                var languages = Client.Languages.Select(lang => new CultureInfo(lang.LanguageShort)).ToList();

                var entrypoint = DigizuiteContentProvider.GetEntryPoint();
                var childrens = ContentLoader.GetDescendents(entrypoint);
                contentLinks.AddRange(childrens);

                return new List<ReindexTarget>()
                {
                    new ReindexTarget
                    {
                        ContentLinks = contentLinks,
                        Languages = languages,
                        SiteDefinition = SiteDefinition.Empty
                    }
                };
            }
        }

        public virtual ContentReference Root
        {
            get
            {
                var entrypoint = DigizuiteContentProvider.GetEntryPoint();
                return entrypoint;
            }
        }
    }
}
  • No labels