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 10 Current »

DAM for Optimizely works well with Optimizely Find. Out of the box, no assets from Digizuite will be indexed. Adding Digizuite assets to the index, 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>> FindGetAll(List<FacetRequest> facets), 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 FindGetAll, 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
using Digizuite.Models;
using Digizuite.Optimizely;
using EPiServer.Find.Cms;
using EPiServer.ServiceLocation;
using EPiServer.Web;
using System.Globalization;

namespace AlloyDevSiteNet6.Business
{
    [ServiceConfiguration(typeof(IReindexInformation), Lifecycle = ServiceInstanceScope.Singleton)]
    public class DigizuiteReindexInformation : IReindexInformation
    {        
        public IDigizuiteClient Client { get; set; }
        public DigizuiteReindexInformation(IDigizuiteClient client)
        {
            this.Client = client;
        }

        public IEnumerable<ReindexTarget> ReindexTargets
        {
            get
            {   
                var languages = Client.Languages.Select(lang => new CultureInfo(lang.LanguageCode)).ToList();
                               
                var facets = new List<FacetRequest>()
                {
                    new FacetRequest()
                    {
                        FacetMode = FacetMode.QueryOnly,
                        Recursive = true,
                        SearchKey = "assetType",
                        Values = new List<string>{"image"}
                    }
                };  
                var assets = Client.FindGetAll(facets).GetAwaiter().GetResult();

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

        public ContentReference Root
        {
            get
            {                
                return DigizuiteContentProvider.GetEntryPoint();
            }
        }
    }
}


  • No labels