0

We have a custom database named Preview and are able to publish to this, but the preview index is not getting updated when an item is published. If we manually rebuild via the CMS, the item will then show in the index (and the page that references the index as its source for data).

We have the following configuration and have already tested clearing the Event Queue and the other recommendation to remove last updated from the Core database. We are running XM 10.2 so the Core database is only in use by the CMS:

Custom Index Strategy Defined

<?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/"  xmlns:environment="http://www.sitecore.net/xmlconfig/environment/"  xmlns:database="http://www.sitecore.net/xmlconfig/database/">
    <!-- This patch file adds an index update strategy for the Preview database -->
    <sitecore role:require="ContentManagement" search:require="solr" environment:require="PROD">
<contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
      </configuration>
      <indexConfigurations>
        <indexUpdateStrategies>
          <onPublishEndPreviewAsync type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch" role:require="Standalone or ContentManagement or ContentDelivery">
            <param desc="database">preview</param>
            <CheckForThreshold>true</CheckForThreshold>
          </onPublishEndPreviewAsync>
          <onPublishEndPreviewAsyncSingleInstance type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousSingleInstanceStrategy, Sitecore.ContentSearch" singleInstance="true" role:require="Standalone or ContentManagement or ContentDelivery">
            <param desc="database">preview</param>
            <CheckForThreshold>true</CheckForThreshold>
          </onPublishEndPreviewAsyncSingleInstance>
        </indexUpdateStrategies>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

Custom Index Strategy Used

<?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/"  xmlns:environment="http://www.sitecore.net/xmlconfig/environment/"  xmlns:database="http://www.sitecore.net/xmlconfig/database/">
    <sitecore role:require="ContentDelivery" search:require="solr" environment:require="PROD" database:require="preview">
        <contentSearch>
            <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
                <indexes hint="list:AddIndex">
                    <index id="sitecore_preview_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
                        <param desc="name">$(id)</param>
                        <param desc="core">$(id)MainAlias</param>
                        <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
                        <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
                        <strategies hint="list:AddStrategy">
                            <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" role:require="(ContentManagement and !Indexing) or (ContentDelivery and !Indexing)"/>
                            <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndPreviewAsyncSingleInstance" role:require="Standalone or (ContentManagement and Indexing) or (ContentDelivery and Indexing)" />
                        </strategies>
                        <locations hint="list:AddCrawler">
                            <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                                <Database>preview</Database>
                                <Root>/sitecore</Root>
                            </crawler>
                        </locations>
                        <enableItemLanguageFallback>false</enableItemLanguageFallback>
                        <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
                    </index>
                </indexes>
            </configuration>
        </contentSearch>
    </sitecore>
</configuration>

1 Answer 1

2

Can you try updating the indexing strategy as below:

<strategies hint="list:AddStrategy" role:require="Standalone or ContentManagement">
     <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndPreviewAsyncSingleInstance" />
</strategies>
<strategies hint="list:AddStrategy" role:require="ContentDelivery">
    <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
</strategies>

On the CM role, we need to have OnPublishEndAsync or OnPublishEndAsyncSingleInstance strategy and on the CD role, it can be manual.

Hope that helps!!!

2
  • Great call out and worth a try. Will keep you posted.
    – Kode
    Commented May 22 at 21:38
  • Gave it a try but it didn't work. We have a ticket with Sitecore Support open.
    – Kode
    Commented Jun 3 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.