0

We have two data templates. Let's say one is called Parent and the other is called Child. The Parent data template has a multi-list field called SelectedChildren that lets the author select one or more Child items. We have a custom computed index field for the Parent data template that uses data from the selected Child items. This site uses both SOLR and Coveo. The SOLR index has everything in the entire content tree. The Coveo index only has the Parent items but does not have the Child items. (There are a huge number of Child items and we would rather not include them in the Coveo index) The problem that we currently have is that when Child items are updated we need the Coveo index for the related Parents to also be updated. Any ideas? If the Child items were also in the Coveo index then I could create a custom coveoItemProcessingPipeline processor that would handle indexing the parents whenever the children got indexed. I am open to any suggestions. Basically I am trying to figure out how I can trigger a re-index of a Parent item whenever a Child item gets indexed - and the Parent item is in both the SOLR and Coveo index, but the Child item is only in the SOLR index.

1
  • Not 100% sure, just as a suggestion, you can create a publish event, in which you can index parents while publishing the child items based on your conditions. Apr 6 at 9:14

1 Answer 1

0
  • First of all you need to update coveo indexing strategies, so index rebuild must happen while publishing.(coveoOnPublishEndAsync) https://docs.coveo.com/en/2218/coveo-for-sitecore-v5/use-indexing-strategies
  • You can use Sitecore's inbuilt processor "GetItemReferencesProcessor" to publish referenced items.
  • You can customized your publishing, which would eventually trigger the coveo indexing.
  • Sharing link for more details

http://maxslabyak.com/2014/03/19/publish-related-items-defining-custom-relationships-via-code-sitecore/

Config Patch:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
         <getItemReferences>
            <processor type="Sitecore.Custom.Publishing.PublishCrossSells, Sitecore.Custom.Publishing"/>
          </getItemReferences>
     </pipelines>
  </sitecore>
</configuration>

C#:

namespace Sitecore.Custom.Publishing
{
public class PublishCrossSells : GetItemReferencesProcessor
    { 
 public override void Process(PublishItemContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            List itemReferences = GetItemReferences(context); // this line calls the method from your custom class
            RegisterReferences(itemReferences, context); // this line registers the references to the related items.
        }
   }    
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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