In order for SharePoint site collections to forward search queries to a search center, the connection to the search center must be configured. In this recipe, we will configure our site collection to forward search queries to the search center we created in the Creating a search center site recipe.
Follow these steps to connect a site collection to a search center:
If the search center is on the same web application host as the site collection, a relative URL may be used instead. For instance, /sites/search/pages
may be used instead of http://sharepoint/sites/search/pages.
Site collections not configured to forward search queries to a search center are limited to only searching within the current site. These searches use the basic search results page found in the /_layouts/
folder of each site. When search queries are forwarded to a search center, the results include all indexed content the user has access to.
The search center URL configured for a site collection may also be configured with PowerShell or code using the server-side object model.
Follow these steps to connect a site collection to a search center using PowerShell:
Get-SPSite
Cmdlet:$site = Get-SPSite http://sharepoint
SRCH_ENH_FTR_URL_SITE
property of the root site to the URL of the Pages library in the search center:$site.RootWeb.AllProperties["SRCH_ENH_FTR_URL_SITE"] = "/sites/search/pages"
$site.RootWeb.Update()
Follow these steps to connect a site collection to a search center with code using the server-side object model:
using
statement:using (var site = new SPSite("http://sharepoint"))
SRCH_ENH_FTR_URL_SITE
property of the root site to the URL of the Pages library in the search center:site.RootWeb.AllProperties["SRCH_ENH_FTR_URL_SITE"] = "/sites/search/pages";
site.RootWeb.Update();
18.191.186.219