I have a executable that I added to the Pipeline Extensibility to split a multi value property. This works but it looks like the process gets invoked for all of content sources.

Is there a way to restrict it to just run for one of my content sources?


It is not possible to execute the custom pipeline extensibility step for a specific content source only. You'll need to handle that in your code.


Since the Pipeline Extensibility is not restricted to any content source you do not have a proper API for this scenario, but you can try achieving it in a not elegant and dirty way.

On every input item you can get the item's URL from the XML and compere the start address to the content source start address and if they match you can process the item else move on to the next input item.

For example:

Get the item Url:

XDocument inputDoc = XDocument.Load(args[0]);

            // retrieve the url input property value
            string url = (from cp in inputDoc.Descendants("CrawledProperty")
                          where new Guid(cp.Attribute("propertySet").Value).Equals(PROPERTYSET_SPECIAL) &&
                          cp.Attribute("propertyName").Value == "url" &&
                          cp.Attribute("varType").Value == "31"
                          select cp.Value).First();

Check if content source contains item url:

public bool CheckSourceAdress(string contentSource,string itemUrl)
            string siteURL = SPContext.Current.Site.Url;
            string contentSSA = HttpUtility.UrlDecode(HttpContext.Current.Request["ConName"]);
            using (SPSite site = new SPSite(siteURL))
                // Gets the service context for a selected site
                SPServiceContext serviceContext = SPServiceContext.GetContext(site);

                // Access the service proxy instance of search application proxy.
                SearchServiceApplicationProxy searchApplicationProxy = serviceContext.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as SearchServiceApplicationProxy;

                SearchServiceApplication searchApplication = Microsoft.Office.Server.Search.Administration.SearchService.Service.SearchApplications.GetValue<SearchServiceApplication>(contentSSA);
                if (searchApplication != null)
                    Microsoft.Office.Server.Search.Administration.Content sspContent = new Microsoft.Office.Server.Search.Administration.Content(searchApplication);
                    ContentSourceCollection sspContentSources = sspContent.ContentSources;

                    foreach (ContentSource cs in sspContentSources)
                        if (cs.Name == contentSource)
                            foreach (Uri url in cs.StartAddresses)
                              return True;

                        return False;
            return sources;
  • Thanks Alex! Thats what I was afraid of. The big problem for me is that process being spun up for each item during the crawl makes it really slow. The conent source that I need to do the split on is only 4,000 records so that would be do able but there is also a content source on that farm that takes about a day to run and I think this would kill it. Do you know if there is any way to do the check without having the process spun up?
    – e82.eric
    Apr 11 '13 at 23:58
  • Unforchenatly I don't have any idea. Apr 12 '13 at 8:24
  • 1
    You can include the ContentSource as a crawled property and check on that. See social.technet.microsoft.com/Forums/en-US/fastsharepoint/thread/… for more infor. Apr 19 '13 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.