Gravatar for diego.moretto@xcentium.com

Question by Diego, Jan 9, 2015 11:14 AM

Custom Inbound Index not working

Hello I followed the example on the following link but I can´t seem to make a custom filter work. https://developers.coveo.com/display/public/SC201409/Excluding+Items+Using+Inbound+Filter+Pipelines

I uncommented this section on Coveo.SearchProvider.config /sitecore/content/Site/Home

this is how my custom inbound index looks like:

namespace SiteSearch.Coveo { public class InboundIndexContentOnlyFilter : InboundIndexFilterProcessor { ///

/// Filters only content tree items and remove components from the filter /// /// public override void Process(InboundIndexFilterArgs args) { var item = args.IndexableToIndex as SitecoreIndexableItem; if (item != null && item.Item != null) { if (!item.Item.Paths.Path.StartsWith("/sitecore/content/Site/Home")) args.IsExcluded = true;

            if (item.Item.Parent != null &&
                (item.Item.Parent.Name == "Page Components" || item.Item.Name == "Page Components"))
            {
                args.IsExcluded = true;
            }
        }
        else
        {
            Sitecore.Diagnostics.Log.Error("Could not run index. Items are null", args);
        }
    }
}

}

When I run the index it doesn´t remove templates or standard values for example. I even at some point move and forced so args.IsExcluded to alway be true and try to reindex but on CES Console I don´t see it getting removed and I can query on the admin tool and I see it there. any ideas?

thanks

3 Replies
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Jan 9, 2015 1:39 PM

HI Diego,

Did you remove the default inbound filter from Sitecore? In this page : https://developers.coveo.com/display/SC201501/Excluding+Sitecore+Items+From+Your+Index Follow step #2 of the 'Configuring the Inbound Filter' section.

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jan 9, 2015 11:44 AM

Can you check the Sitecore logs to check for any error related to this processor? Sitecore may fail to assign the value to the contentstartpaths property as this property doesn't exist on your processor class. Thus, it may not use any processor at all.

Gravatar for diego.moretto@xcentium.com

Answer by Diego, Jan 9, 2015 3:12 PM

I don´t see any issues on the log. I did change a bit my code to spit on the sitecore logs the output and some items still get indexed even though the args.IsExcluded is set to true:

var item = args.IndexableToIndex as SitecoreIndexableItem; if (item != null && item.Item != null) { if (!item.Item.Paths.Path.StartsWith("/sitecore/content/Site/Home")) { args.IsExcluded = true; Sitecore.Diagnostics.Log.Info("Coveo index ran for item " + item.Item.Name + ". Excluded: " + args.IsExcluded, args); }

            if (item.Item.Parent != null &&
                (item.Item.Parent.Name == "Page Components" || item.Item.Name == "Page Components"))
            {
                args.IsExcluded = true;
                Sitecore.Diagnostics.Log.Info("Coveo index ran for component. Item:" + item.Item.Name + ". \n Parent:" + item.Item.Parent.Name + " Excluded: " + args.IsExcluded, args);
            }

        }
        else
        {
            Sitecore.Diagnostics.Log.Error("Could not run index. Items are null", args);
        }

One of the items was on the log: ManagedPoolThread #9 14:58:54 INFO Coveo index ran for component. Item:Page Components. Parent:CPA-Coveo-Test Excluded: True

BUT this got pushed to the index although args.IsExcluded was set to true. any ideas?

Ask a question