Monday 31 March 2014

Upgrade Search Settings and result sources using PowerShell in SharePoint 2013

I came up with a requirement where I want the user to search the results only from the site collection level. In SharePoint 2010, we all know there are search scopes which help us to narrow down our search based on content sources, web address and metadata. However; there is no search scopes in SharePoint 2013. There is a new concept similar to Search Scope called as Search Result Sources.

This Result sources can be created at "Application Level", "Site Collection Level" and "Site Level".

You could find more information on Result Sources in SharePoint 2013 @ http://technet.microsoft.com/en-us/library/dn186229(v=office.15).aspx

I decided to script out the following
1. Creation of Enterprise Search Centre site
2. Update the search settings to point to this new search centre instead of default OSSSearchResults page.
3. Create a site collection level result source
4. Update the search results webpart properties to query only at above created site collection result source.

1. Create Enterprise Search Centre via PowerShell

Note: you need to activate the "BaseSite" Collection hidden feature before creating the search centre.
2. Settings the results page for your above search centre

3. Create a Site Collection level result source

4. Update the search results webpart to use this above result source for query.

Hope you like my approach.
enjoy!!
Isha Jain

No comments:

Post a Comment