Tuesday, September 24, 2013

Set All Search boxes to use the search center in SharePoint 2013

In SharePoint Site search boxes will crawl the data from local sites. We can see “Expand your search” link that redirects the search center, whenever we configure the global search center in the application. We can configure the search boxes in site level and site collection level in site settings (Site Settings -> Site Collection Administration -> Search Settings) Site level (Site Settings -> Search -> Search Settings)


















In SharePoint it is always not possible to modify in all the sites and site collections. Steve Mann wrote power shell commands to loop all the site collections and apply search center URL.

$webApp = Get-SPWebApplication “Web Application URL
foreach ($siteColl in $webApp.Sites)
{
    if ($siteColl -ne $null)
    {
        $site = Get-SPWeb $ siteColl.Url      
        $site.AllProperties["SRCH_SB_SET_SITE"] = 
                {"Inherit":false,"ResultsPageAddress":"/sites/SearchCenter/Pages/results.aspx","ShowNavigation":false}'
        $site.AllProperties["SRCH_ENH_FTR_URL_SITE"] = '/sites/SearchCenter/Pages'
        $site.Update();
    }
}

Here SRCH_SB_SET_SITE, SRCH_ENH_FTR_URL_SITE are properties. We can find about more in these links


Share this