Connecting a site collection to a search center

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.

How to do it…

Follow these steps to connect a site collection to a search center:

  1. In your preferred web browser, navigate to the site collection to which we are connecting the search center.
  2. Click on Site settings from the Settings menu.
  3. Select Search Settings under Site Collection Administration as shown in the following screenshot:
    How to do it…
  4. Enter the URL to the Pages library in the search center. For instance, if the search center is at http://sharepoint/sites/search, enter http://sharepoint/sites/search/pages for the URL as shown in the following screenshot:
    How to do it…

    Tip

    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.

  5. Click on OK.

How it works…

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.

Note

The URL to the search center is stored as a property on the root site of the site collection.

There's more…

The search center URL configured for a site collection may also be configured with PowerShell or code using the server-side object model.

Connecting a site collection to a search center using PowerShell

Follow these steps to connect a site collection to a search center using PowerShell:

  1. Assign the site collection to a variable with the Get-SPSite Cmdlet:
    $site = Get-SPSite http://sharepoint
    
  2. Set the 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"
    
  3. Update the root site of the site collection:
    $site.RootWeb.Update()
    

Connecting a site collection to a search center with code using the server-side object model

Follow these steps to connect a site collection to a search center with code using the server-side object model:

  1. Open the site collection in a using statement:
    using (var site = new SPSite("http://sharepoint"))
  2. Set the 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";
  3. Update the root site of the site collection:
    site.RootWeb.Update();
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.186.219