I want to know how to remove sitecore item field from indexing for coveo search. I know it will possible trough coveo.searchprovider.config
https://developers.coveo.com/display/public/SitecoreV3/Customizing+the+Indexing+Parametersenter link description here
<exclude hint="list:AddExcludedField">
<fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
</exclude>
But I want to be create property at field level which will indicate to exclude from index and using that property checkbox I want to exclude from coveo index.
Will it be poosible trough pipeline which explain following blog https://developers.coveo.com/display/public/SitecoreV3/Excluding+Sitecore+Items+From+Your+Index
Yes, an inbound filter is what you are looking for.
public class ApplyCoveoInboundIndexShouldBeExcludedFieldFilter : AbstractCoveoInboundFilterProcessor
{
public override void Process(CoveoInboundFilterPipelineArgs args)
{
if (args.IndexableToIndex != null && !args.IsExcluded && ShouldExecute(args)) {
if (ItemShouldBeExcluded(args.IndexableToIndex.Item)) {
args.IsExcluded = true;
}
}
}
private bool ItemShouldBeExcluded(IItem item) {
return item.GetFieldValue("SHOULD_INDEX_ITEM_FIELD_NAME") == "0";
}
}
Modify the ItemShouldBeExcluded
method according to your needs.