Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 2


using Digizuite.Models;
using Digizuite.Optimizely;
using 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.

Code Block
languagec#
titleReindexInformation 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();

...

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

...



                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;
            }
        }
    }
}