Click here to Skip to main content
15,886,362 members
Articles / Productivity Apps and Services / Sharepoint
Technical Blog

Fast Search Pipeline Extensibility for Specific Content Source

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
4 Dec 2013CPOL 7.3K   1  
Fast search pipeline extensibility for specific content source.

Since the Pipeline Extensibility is not restricted to any content source and the fact that you do not have a proper API, makes it really hard to work with a specific Content Source.

Luckily for us we have a Crawled property which is mapped to the managed property “ContentSource”:

XML
<CrawledProperty propertySet="012357BD-1113-171D-1F25-292BB0B0B0B0" varType="31" propertyName="315" />

So you can include this in your extensibility configuration and you can see which content source the data came from and apply appropriate logic.

Example:

C#
static void Main(string[] args)
{

 XDocument inputDoc = XDocument.Load(args[0]);
 XElement outputElement = new XElement("Document");
 //get Content Source from input file
 string contentSourceName = GetContentSource(inputDoc);

 if (contentSourceName == "My Content Source")
 {
     //your logic
 }

 outputElement.Save(args[1]);
}
private static string GetContentSource(XDocument inputDoc)
{
     var res = from cp in inputDoc.Descendants("CrawledProperty")
               where new Guid(cp.Attribute("PropertySet").Value).Equals(
                 new Guid("012357BD-1113-171D-1F25-292BB0B0B0B0")) &&
               cp.Attribute("PropertyID").Value == "315"
               select cp.Value;
     return res.First();
}

This way we managed to apply our own logic for a specific Content Source.

Reference:

I would like to thank Jorge Einbund, a talented .NET developer for helping me with this post.

Hope you’ll find this post helpful.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) E4D
Israel Israel
Alex Choroshin is working as a Consultant/Web Developer at LogoUi company , he has a vast experience developing client side solutions and single page application using the latest web technologies: HTML5, CSS3 , AngularJS, JQuery, SignalR, ASP.NET MVC4, Web API, NodeJS etc.

Also experience with the SharePoint 2010 & SharePoint 2013 platform encompassing all the aspects of SharePoint architecture and development.

Comments and Discussions

 
-- There are no messages in this forum --