Showing posts with label search center. Show all posts
Showing posts with label search center. Show all posts

Tuesday, July 2, 2013

SharePoint 2013 Search: Setting All Search Boxes to Use Your Search Center

Search boxes that appear on your sites and sub-sites will automatically render local results first and if you have the global search center set in your Search Service Application, a link appears to "expand your search" which then navigates to your search center.

You may configure the search boxes to navigate to your search center at both the site collection and site level. This is performed under Site Settings -> Site Collection Administration -> Search Settings for the site collection and Site Settings -> Search -> Search Settings for the site level. If you configure these settings at the site collection level, the same settings will be used for all sites within the site collection unless modified.

In setting up our new SharePoint 2013 farm, navigating through hundreds of site collections to modify these settings was not an option. Therefore I wrote a simple PowerShell script to loop through all site collections within a given web application and apply the search center URL and result page to them:

$SPWebApp = Get-SPWebApplication http://sp2013
foreach ($SPSite in $SPWebApp.Sites)
{
    if ($SPSite -ne $null)
    {
        $web = Get-SPWeb $spsite.Url       
        $web.AllProperties["SRCH_SB_SET_SITE"] =  

                {"Inherit":false,"ResultsPageAddress":"/sites/SearchCenter/Pages/results.aspx","ShowNavigation":false}'
        $web.AllProperties["SRCH_ENH_FTR_URL_SITE"] = '/sites/SearchCenter/Pages'
        $web.Update();

    }
}


EASY!


I found a post here that shows how to loop through each sub-site (SPWeb) and set the settings at the site level, however, I believe I have achieved my goal just by setting these values at the site collection level.



 

Matched Content