Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DAM for Optimizely works well with Optimizely Find. To get the most out of it you might want to even add the individual Out of the box, no assets from Digizuite will be indexed. Adding Digizuite assets to the index. This , can be done by adding a ReindexInformation provider as shown below. In the example below we use the IDigizuiteClientclass to access assets from Digizuite. The method Task<IEnumerable<ContentReference>> GetAllContentReferences(List<FacetRequest> facets = null), is used for searhing assets from digizuite, which then can be added to the index. Here we search for all assets of assettype “image” and add them to the index. If you dont send any parameters to GetAllContentReferences, then you get all assets that has been added to the Optimizely channel in Digizuite. You can read more about how to add filter to the search DC 5.8 SDK Asset search.

ReindexInformation Provider
Code Block
languagec#
titleReindexInformation Provider
using SystemDigizuite.Collections.GenericModels;
using SystemDigizuite.GlobalizationOptimizely;
using System.Linq;
using EPiServer;
using EPiServer.CoreEPiServer.Find.Cms;
using EPiServer.Find.CmsServiceLocation;
using EPiServer.ServiceLocationWeb;
using EPiServerSystem.WebGlobalization;

namespace Digizuite.Episerver.Examples.FindAlloyDevSiteNet6.Business
{
    [ServiceConfiguration(typeof(IReindexInformation), Lifecycle = ServiceInstanceScope.Singleton)]
    public class DigizuiteReindexInformation : IReindexInformation
    {        
        public IContentLoaderIDigizuiteClient ContentLoaderClient { get; set; }

        public DigizuiteReindexInformation(IDigizuiteClient client)
        {
            this.Client {= getclient; set;
        }

        public DigizuiteReindexInformation(IContentLoader contentloader, IDigizuiteClient client)IEnumerable<ReindexTarget> ReindexTargets
        {
            get
            {   
             this.ContentLoader   var languages = Client.Languages.Select(lang = contentloader;> new CultureInfo(lang.LanguageCode)).ToList();
                               this.Client = client;
                var facets = new List<FacetRequest>()
           }     {
    public virtual IEnumerable<ReindexTarget> ReindexTargets         {    new FacetRequest()
       get             {
                   if (Client.Folders == null)     FacetMode = FacetMode.QueryOnly,
                        Recursive = true,
   return new List<ReindexTarget>();                  var contentLinksSearchKey = new List<ContentReference>(); "assetType",
                     var languages = Client.Languages.Select(lang Values => new CultureInfo(lang.LanguageShort)).ToList();List<string>{"image"}
                   var entrypoint}
= DigizuiteContentProvider.GetEntryPoint();               };  var
childrens = ContentLoader.GetDescendents(entrypoint);              var assets  contentLinks.AddRange(childrens= Client.GetAllContentReferences(facets).GetAwaiter().GetResult();

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

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