Skip to main content
3 of 3
added 51 characters in body

For an Official Solution...Sitecore Support

The documentation that you are referring to is actually the KnowledgeBase article for "Known issues for Sitecore 8.2", and the statement that you quoted is actually an entry that lists this as a known issue for the Publishing Service in Sitecore 8.2:

The Publishing Service does not maintain the descendant table by default.

You should reach out to Sitecore Support for this issue. Since there is no reference number included with the entry, you should link them to the KB article and mention the quoted text to see if they can provide you with a workaround/patch.

Workaround Mentioned by @MarkCassidy:

As mentioned by Mark in the comments on this post, you could work around this issue by writing a handler for the publish:complete event that executes the database cleanup for the Web database. Note that this may or may not be the most desirable solution - I still recommend reaching out to Sitecore first, in case they have a more efficient patch.

What you would need is a patch-config, similar to the following:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>     
    <events>     
        <event name="publish:complete">     
            <handler type="MyProject.EventHandlers.DatabaseCleanup, MyProject" method="OnPublishComplete" />     
        </event>      
    </events>     
</sitecore>
</configuration>

And then a class similar to the following:

namespace MyProject.EventHandlers
{
    public class DatabaseCleanup 
    {
        public void OnPublishComplete(object sender, EventArgs args)     
        {     
            var sitecoreArgs = args as Sitecore.Events.SitecoreEventArgs;     
            if (sitecoreArgs == null) 
            {
                return;
            }

            var publishingOptions = sitecoreArgs.Parameters[0] as IEnumerable<DistributedPublishOptions>;
            if (publishingOptions == null) 
            {
                return;
            }

            var targetDatabases = publishingOptions
                .Select(option => option.TargetDatabaseName);
            foreach(var databaseName in targetDatabases) 
            {
                var database = Sitecore.Configuration.Database.GetDatabase(databaseName);
                database?.CleanupDatabase();
            }
        }
    }
}