By Sharada Harnal on Jul 23, 2013 4:54:33 AM
SharePoint 2013 Search Migration
Here’s an interesting episode that caught me engaged for a few days. Due to an overhaul in search scope in SharePoint 2013, we had to customize the whole web-part and devise methods in SharePoint 2013 environment to meet end users need.
Earlier in SharePoint 2010, we created a custom search web part for our clients that would provision search amidst Multi-site collections. As our client migrated to SharePoint 2013, the same methods were not applicable due to changes in search scope with certain restrictions in SharePoint 2013 milieu. So we leveraged KQL (Keyword Query Language) attributes to categorise site collections and facilitated attribute based search in SharePoint 2013 environment. Here’s the code we developed while implementing the changes.
static void Main(string args)
using (var context = new ClientContext("http://localhost"))
var query = new KeywordQuery(context)
QueryText = "test",
HiddenConstraints = "Department",
var executor = new SearchExecutor(context);
var results = executor.ExecuteQuery(query);
foreach (var result in results.Value.ResultRows)