Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint

Fast Search Pipeline Extensibility for Specific Content Source

0.00/5 (No votes)
4 Dec 2013CPOL 7.4K  
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)