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 12 Next »

Out of the box the assets synchronized into Sitecore as items, goes into the default index sitecore_master_index and sitecore_web_index. In some cases it make sense to create a custom search index for all the digizuite items. For instance if the users can search for dynamic digizuite content on the website. In this guide we will show an example of an custom search index which will index all digizuite items. We will also control which fields that goes into the index. In this example we use Sitecore 10.2 and Solr v.8.8.2. This guide assume that you know how to install solr and create cores.

Sitecore configuration

DFS.ContentSearch.Solr.Index.Master.config

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
  <sitecore role:require="Standalone or ContentManagement or Processing" search:require="solr">
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="dfs_contentsearch_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <!-- This initializes index property store. Id has to be set to the index id -->
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <configuration ref="contentSearch/indexConfigurations/DFS.ContentSearch.Solr.IndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <!--NOTE: order of these is controls the execution order-->
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
            </strategies>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>master</Database>
                <Root>/sitecore/media library/Digizuite</Root>
              </crawler>              
            </locations>
            <enableItemLanguageFallback>false</enableItemLanguageFallback>
            <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

DFS.ContentSearch.Solr.IndexConfiguration.config

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
  <sitecore search:require="solr">
    <contentSearch>
      <indexConfigurations>
        <!-- If no configuration is specified for an index, it uses the default configuration. The configurations are not merged if the index also has a
             configuration. The system uses either the default configuration or the index configuration. -->
        <DFS.ContentSearch.Solr.IndexConfiguration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration">
          <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
            <indexAllFields>true</indexAllFields>
            
			<include hint="list:AddIncludedTemplate">
              <DFSRootTemplateId>{316978B1-1C41-4F4F-82D5-82863665EDE6}</DFSRootTemplateId>
              <AssetsSiloTemplateId>{4133449F-6EC1-4D10-A930-3EC828650FA6}</AssetsSiloTemplateId>
              <AssetTemplateId>{2D63B0B3-89AA-4A87-9A32-D822C71B5BD8}</AssetTemplateId>      
              <MappedEntityTemplateId>{B8879FB6-ADE9-4971-B580-CF0073FC182A}</MappedEntityTemplateId>
              <DigizuiteEntityTemplateId>{801EC0D4-6D99-4609-B042-96388D314BFD}</DigizuiteEntityTemplateId> 
            </include>
			
            <fields hint="raw:AddComputedIndexField">
              <field fieldName="mfTitle" metafieldGuid="5eb3eefc-a043-410f-89b0-29ed3ef37078" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.DynamicMetadata, DFS.Client.Services</field>   			  
			  <field fieldName="mfPublishTo" metafieldGuid="74a5a102-a310-4bb7-9e84-0b14c36436b2" returnType="stringCollection">DFS.Client.Services.ContentSearch.ComputedFields.DynamicMetadata, DFS.Client.Services</field>	
			  <field fieldName="thumbHtmlTag" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.ThumbHtmlTag, DFS.Client.Services</field>   
			  <field fieldName="derivedFrom" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.DerivedFrom, DFS.Client.Services</field>   			  
            </fields>				
          </documentOptions> 
        </DFS.ContentSearch.Solr.IndexConfiguration>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

  • No labels