2017-08-22 34 views
1

我想知道如何從索引中刪除sitecore項目字段以進行coveo搜索。我知道這將可能槽coveo.searchprovider.config如何從索引中刪除sitecore項目字段以進行coveo搜索

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> 

但我想創造在實地一級屬性,它指示從索引中排除,並使用該屬性複選框,我想排除來自coveo索引。

會不會是哪個講解以下博客 https://developers.coveo.com/display/public/SitecoreV3/Excluding+Sitecore+Items+From+Your+Index

回答

2

是,入站過濾器是你在找什麼poosible槽管道。

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"; 
    } 
} 

根據您的需要修改ItemShouldBeExcluded方法。