Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<configuration xmlns:patch="">
<processor type="MySolution.Coveo.Custom.InboundFilters.IsPublishableInboundFilter, MySolution.Coveo.Custom" />
using Coveo.Framework.Items;
using Coveo.SearchProvider.InboundFilters;
using Coveo.SearchProvider.Pipelines;
namespace MySolution.Coveo.Custom.InboundFilters
public class IsPublishableInboundFilter : AbstractCoveoInboundFilterProcessor
public override void Process(CoveoInboundFilterPipelineArgs args)
if (args.IndexableToIndex != null && !args.IsExcluded && ShouldExecute(args))
var item = args.IndexableToIndex.Item;
if (item.Publishing.NeverPublish)
args.IsExcluded = true;
args.IsExcluded = !AllAncestorsArePublishable(item);
private bool AllAncestorsArePublishable(IItem item)
if (item.Parent != null && item.Parent.Publishing.NeverPublish)
return false;
else if (item.Parent != null)
return AllAncestorsArePublishable(item.Parent);
return true;

This comment has been minimized.

Copy link
Owner Author

@dcouto dcouto commented Nov 1, 2018

Updated based on feedback from @jflheureux from Coveo. Thank you, Jeff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment