SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

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;
share|improve this answer
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. – Alex Choroshin Apr 12 '13 at 8:24
You can include the ContentSource as a crawled property and check on that. See… for more infor. – Mikael Svenson Apr 19 '13 at 18:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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