Pages

12 January, 2022

Sitecore site definition inheritance supports single level only

Sitecore Html cache was not working even though cacheHtml attribute in site definition and caching.Enabled setting were true. Our site uses site definition inheritance. cacheHtml attribute was true in the parent's parent site definition. 

Background on inherit attribute: Sitecore can inherit the site definition properties from another site definition. It is available for quite a while but it has been prominent after JSS site definition template uses it. 

As per Sitecore's comments in Sitecore.config file: 

inherits: Indicates that the attributes should be inherited from another site. To enable inheritance, you must specify the name of the source site. Attributes that are explicitly specified overwrite the attributes that are inherited from the source site.

As per stackexchange, there is no easy way to check the final Site definition after inheritance. Michael West (@MichaelWest101) posted a Sitecore PowerShell script to check it. As per the comment in the post, Sitecore gets the inherited properties from the immediate parent site definition. There is no logic to get it from the multi level site definition inheritance. 

After we added the cacheHtml attribute to the immediate parent site definition, caching started to work. It is clear that only the immediate parent attributes will be inherited to the child child definition.  

   <sites>
      <site inherits="website"
            name="custom-common"
            cacheHtml="true"
            language="en"
            .......
            patch:before="site[@name='website']"/>    

      <site inherits="site1"
            name="site1"    
            rootPath="/sitecore/content/site1"
            startItem="/home"                    
            patch:before="site[@name='custom-common']"/>

      <site inherits="site2"
            name="site2"    
            rootPath="/sitecore/content/site2"
            startItem="/home"                    
            patch:before="site[@name='custom-common']"/>
    </sites>

04 January, 2022

Sitecore xDB Index Rebuild - Stuck at Finishing stage with 95% completion

In a Sitecore Managed Cloud instance, I started to rebuild the xDB Index. 

  • I opened Kudu console of xxx--xc-search App Service. 
  • Changed folder to "D:\home\site\wwwroot\App_Data\jobs\continuous\IndexWorker". 
  • Ran .\Sitecore.XConnectSearchIndexer.exe -rr (or .\Sitecore.XConnectSearchIndexer.exe -requestrebuild).
After waiting for a long time, I checked the status of the rebuild and it was stuck at the stage "Finishing" with 95% completed. I restarted the rebuild again and same results after several hours. In my local machine, it has completed without any problem. 

To check the status of the rebuild in Sitecore 10, you can run .\Sitecore.XConnectSearchIndexer.exe -rm (or .\Sitecore.XConnectSearchIndexer.exe -rebuildmonitor).

Downloaded the entire application content (D:\home\site\wwwroot\App_Data\jobs\continuous\IndexWorker) and compared it with local setup. I could see a different setting for Solr Writer - MaximumCommitMilliseconds in "IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexWriter.SOLR.xml". It was 600000 in Managed cloud setup. I changed it to 1000 and started the rebuild. After several hours, it completed successfully. 

If the Sitecore solution depends on Real Time xDB updates, then we should have default value which is 1000 or near to it. Our solution is not dependent on xDB real time updates but we kept it to default to make sure our rebuild process completes. This KB page explains the reason for updating the setting. 

Rebuild stages:

Default

No index rebuild is requested or running.

RebuildRequested

The index rebuild is requested but has not started yet.

Starting

The index rebuild is in the preparation stage.

RebuildingExistingData

The existing xDB collection data is being extracted and re-indexed.

RebuildingIncomingChanges

Data added during the previous stage is being indexed.

Finishing

The post-rebuild steps are being performed.

Finished

The index rebuild activities have finished.

07 December, 2021

Sitecore PowerShell - Get All Sitecore Users With Basic Properties

Saving the handy script to get all the Sitecore Users with basic properties like Is Admin, Is locked out, email address etc. 



blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }