4

Prior to the SPS (Sitecore Publishing Service), I was using the PublishManager in code to automatically publish data coming from our backend system. I am not only publishing the item that are created/updated but one of the ancestors as well.

I need the ancestor to publish, even though there are no changes to that item, so that the index is updated. The index contains fields based on the created/updated item. Therefore, I turned off SmartPublish and PublishSubItems. (deep and compareRevisions parameters)

After installing the SPS, the created/updated item publishes ok using the PublishingManager however the SPS does not publish the ancestor (thus not updating the index).

Is there any way to force a "re-publish" in code with the new SPS?

1
  • By forcing a republishing, you mean a full site republish? Commented Mar 31, 2017 at 19:33

1 Answer 1

2

As the publishing service should have an open api, you should be able to send requests to it (maybe Stephen Pope can elaborate on that).

I'm not sure how to do that, but if you only need that publish to update your index you might be able to get what you need by using the IndexCustodian. That class has functions to rebuild your entire index, or parts of it. In your case you will need somehting like:

IndexCustodian.RefreshTree(new SitecoreIndexableItem(ancestor);

or

foreach (var index in ContentSearchManager.Indexes)
{
    IndexCustodian.Refresh(index, new SitecoreIndexableItem(ancestor);
}

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.