A Tale from Sitecore Publishing Content Availability feature




In my last post, I wrote about the incident of content unavailability. What we thought as a problem solved re-emerged again in our higher environments. We didn't panic as we already dealt with the problem in the past. And as an ideal developer, last time, we recorded the steps for future reference that came in handy.


Issue this time:


When we encountered content unavailability last time, it was due to disabled Solr index configuration file. We fixed that issue in QA and when we installed publishing service module in the Production environment, we strictly followed the post-install action listed in the module description.




There is only one config file we needed to copy to CD roles. So, we just copied that. When my colleague continued with his deployment and started testing the pages, we again ran into an issue of search results not found. He tried looking into the logs for patterns. He found a pattern below that suggested _isavailable field is not available on the SearchResultItem.


Background of _isavailable field:


This field is a virtual filed and is introduced by the publishing service module. It is available in below path on both CM and CD role instances.

App_Config/Modules/PublishingService/Sitecore.Publishing.Service.ContentAvailability.solr.config


But wait, this just adds a virtual field into the default Solr Index configuration. So, where exactly this field is added to the query when making search requests?

The answer to above question lies in App_Config/Modules/PublishingService/Sitecore.Publishing.Service.ContentAvailability.config.


Publishing service module introduced this file and it adds a new filtering processor to search pipeline. And this specific processor is the one that appends the "_isavailable" true condition to search criteria.






Now that we know the sequence of why this issue occurred, we quickly enabled the contentavailability and contentavailability.solr.config files on CD servers.
With this change, we are back in the game. Search results started showing soon after this update.

But that is not the full story. I wouldn't have felt obligated to write this blog had it been the above issue. Well, it's straight forward. Maybe an hour or so into the issue, one with right Sitecore brain can easily crack this.
However, the extension of the above story triggered when we continued to follow the Content availability guide further.


Issue from enabling Content Availability on Publishing service


Following steps is an excerpt from Sitecore publishing service setup guide.

To enable content availability in the Publishing Service:
1. In the config directory of the Publishing Service, enable the sc.publishing.contentavailability.xml file.
2. Restart the Publishing Service.
3. With DEBUG logging enabled, ensure that the Content Availability status is set to ON.

sc.publishing.contentavailability.xml: this file is available at <publishing service siteroot>/config/sitecore/publishing/sc.publishing.contentavailability.xml
Soon after you enable this file, you may encounter the following issue.



System.ArgumentNullException: Type should not be null.
Parameter name: Type
   at Sitecore.Framework.Conditions.RequiresValidator`1.ThrowExceptionCore(String condition, String additionalMessage, ConstraintViolationType type)
   at Sitecore.Framework.Conditions.Throw.ValueShouldNotBeNull[T](ConditionValidator`1 validator, String conditionDescription)
   at Sitecore.Framework.Conditions.ValidatorExtensions.IsNotNull[T](ConditionValidator`1 validator)
   at Microsoft.Extensions.Configuration.ConfigurationServiceType.op_Implicit(ConfigurationServiceType cfg)
   at Sitecore.Framework.Publishing.Host.Startup.<>c__DisplayClass3_0.<ConfigureServices>b__1(ConfigurationServiceType x) in C:\BA\fb80de5dfd630cfc\src\Sitecore.Framework.Publishing.Host\Startup.cs:line 40


Resolution and Reason


Reason for this exception is due to the IncrementalPublishHandler. Once we comment it out the issue will be resolved.


This handler is disabled by Sitecore Out of the box when we install publishing service. You can find this handler inside file: <publishing service siteroot>/config/sitecore/publishing/sc.publishing.services.xml
As per Sitecore documentation, IncrementalPublishHandler is a legacy handler replaced by TreeChangesPublishHandler.




I hope this information will come handy in future to me as well as others who vest their time and efforts on eXcellent Sitecore Platform.
Please let me know if you are interested in hearing about any Sitecore topics.

Comments