Gravatar for abhishek.shrivastava@towerswatson.com

Question by abhisfortitude, Jun 30, 2015 12:44 PM

Sitecore Inbound Filtering: Abort Inbound filter pipeline to certain indexes only.

Hi,

We use Lucene indexes for some section of our website and Coveo Indexes for others. We have "InboundFilters.ItemPathInboundFilter" in Coveo.SearchProvider.config that filters some section of the Content tree so that the Coveo index only have those filtered items. However, what we want is that when we build Lucene indexes, the "InboundFilters.ItemPathInboundFilter" should be aborted so that the filtering does not apply to the Lucene indexes.

We tried to resolve this issue by creating the below pipeline processor and added it to the first processor to <indexing.filterIndex.inbound> pipeline in Coveo.SeachProvider.config. However, that did not work since the index type is LuceneProvider irrespective of Lucene index or Coveo index rebuild.

public class AbortWhenLuceneProviderProcessor : InboundIndexFilterProcessor 
{ 
    private static readonly string COVEOSEARCHPROVIDER = "Coveo.SearchProvider.ProviderIndex"; 

    public override void Process(InboundIndexFilterArgs pArgs) 
    { 
        if (IsIndexingToCoveo(pArgs.IndexableToIndex)) 
            return; 

        //Abort the pipeline if the SearchProvider is NOT Coveo 
        pArgs.AbortPipeline(); 
        return; 
    } 

    protected bool IsIndexingToCoveo(IIndexable indexedItem) 
    { 
        string indexType = string.Empty; 
        ISearchIndex index = ContentSearchManager.GetIndex(indexedItem); 
        if (index != null) 
            indexType = index.GetType().ToString(); 

        return indexType == COVEOSEARCHPROVIDER; 
    }
}

Please guide us to the solution. How can we ensure that <indexing.filterIndex.inbound> is applicable ONLY to Coveo Indexes ?

Gravatar for slangevin@coveo.com

Comment by Simon, Jun 30, 2015 1:54 PM

Currently there is no quick solution for this issue. Coveo support is aware and working with the production team for a possible fix. I will post the resolution on this post as soon as we have one.

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Aug 5, 2015 12:35 PM

A fix has been done for this and will be delivered with September 2015 release, along with the ability to choose which filter is applied to which Coveo index.

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Jun 30, 2015 4:49 PM

Hi,

You could use the CoveoItemProcessingPipeline instead. This processor is used only by Coveo indexes and gives you access to the same arguments the inbound filter has access to.

The only downside of doing this : the delete function is not called for the items you will remove, so this will require a complete rebuild once your processors are added to the config.

You will need to reference the Coveo.SearchProvider.Pipelines.CoveoItemProcessingPipelineArgs, located in the Coveo.SearchProviderBase dll. Here is a code sample:

using Coveo.SearchProvider.Pipelines;
namespace MyProcessors
{
    public class SkipItem
    {
        public void Process(CoveoItemProcessingPipelineArgs p_Args)
        {
           if ([condition]) {
              // Remove the item like this
              p_Args.OutputItems.Remove(p_Args.Item);
           }
        }
    }
}

This pipeline is defined in the Coveo.SearchProvider.config file.

An alternative solution would be to flag items from this pipeline. The inbound filter is called for every items in p_Args.OutputItems. This way you could keep your previously created filters. I haven't tried this solution though.

Gravatar for abhishek.shrivastava@towerswatson.com

Comment by abhisfortitude, Jul 7, 2015 1:38 PM

I implemented all the coveo indexable items filtering logic in the processor withing and was able to get the desired result. Thank you !

Ask a question