This is a blog post in the series “Set up a Search Center in SharePoint 2013”. 

In the previous blog post, I showed you how to create a Search Center Site Collection and enable crawling of your content. In this post you’ll learn:

 

How to turn off versioning for the Pages library
If you don’t want to check pages in and out when you configure the Search Results Web Part, you can turn off versioning for the Pages library.

To turn off versioning for the Pages library:

  1. Go to Site settings --> Site contents.
  2. On the Site Contents page, click the Pages library.
  3. In the Pages library, click the LIBRARY tab and then Library Settings.
  4. On the Settings page, click Versioning settings.
  5. On the Versioning Settings page, in the Content Approval section, for Require content approval for submitted items, select No.
  6. In the Document Version History section, for Create a version each time you edit a file in this document library, select No versioning.
  7. In the Require Check Out section, for Require documents to be checked out before they can be edited, select No.

Turn off versioning for the Pages library

 

Why you should consider creating a result source for your Search Center
A result source specifies where your search results can come from.

For example, in my scenario, I did not want search results to come from all sites within the SharePoint farm. I only wanted search results from one specific site within the farm.

The default result source in a Search Center returns search results from the entire SharePoint farm. If you want search results from the entire SharePoint farm, you can skip to the next blog post in this series.  However, if you want search results from only a sub set within your SharePoint farm (in my scenario, one specific site), you should create a result source.

 

How to create a result source
Depending on your permission level, you create a result source on three levels:

Permission level Where the result source will be added
Search service application administrator To all site collections within the farm
Site collection administrator To all sites within a site collection
Site collection owner To a single site

To save space, I will only show you how to create a result source as a Site collection administrator.

  1. Go to Site settings --> Search Result Sources.
  2. On the Manage Result Sources page, click New Result Source.

New result source

  1. On the Add Result Source page, enter a Name. Select values for Protocol and Type, and click Launch Query Builder. This will open a dialog box.

    In my scenario, I named the result source Articles, and kept the default values for Protocol and Type.

Specify new result source

  1. In the Build Your Query dialog box, define the result source.

    Remember, in my scenario, I only wanted search results to come from a particular site within the farm, so in the Query text field, I added the following:
    {searchTerms?} (contentclass:sts_listitem) path:http://<path>

Specify query for new result source

Now, before we move on, let me break down what I entered:

  • {searchTerms?} In my result source, I wanted to include the words that users type in the query box whey then search for something. Obviously I have no way of knowing what users will type, so I added the query variable {searchTerms?} By the way, you can tell it’s a query variable because it’s enclosed in curly brackets.  When users enter a query, this query variable will be replaced by the words the users have typed in the query box. The question mark at the end of the variable means that if no words have been entered, the variable should be ignored.
  • (contentclass:sts_listitem)  This means that only list items will be included in my result source.
  • path:http://<path>   This is the path to the site from where I wanted search results to come from.  
  1. Test that the result source is working correctly by clicking on the TEST tab, and then Show more.

Test result source

  1. In the {searchTerms} field enter Query words to simulate a query entered by a user, and then click Test query.

    In my scenario, I entered search configuration.

Test specific query for result source

Notice that 52 results were returned (I will tell you why this is kind of cool in the next section…).

  1. Click OK to close the dialog box, and then Save.

So now that we have a result source for the Search Center, we can move on to configuring the Search Results Web Part to use the new result source.

 

How to configure the Search Results Web Part to use a new result source
By default, the Search Results Web Part is used on the search results page. In order to configure the Search Result Web Part, you have to navigate to the search results page.

  1. On your Search Center home page (the default URL to this page is <site>/Pages/default.aspx), enter a query in the search box, and press Enter.

    In my scenario, I entered search configuration.

Enter query on search page

When you press Enter, you will be taken to the to the search results page (the default URL to this page is <site>/Pages/results.aspx).

In my scenario, 1,051 search results were returned.

Default search results showing 1,051 results

Remember, by default you’ll get search results from the entire SharePoint farm. To change this so that only search results from your newly created result source are returned, here’s what you should do:

  1. On the search results page, click the Settings menu --> Edit Page.
  2. In the Search Results Web Part, click the Web Part Menu, and then Edit Web Part.

Edit Web Part

  1. In the Web Part tool pane, click Change query. This will open a dialog box.

Change query in Web Part tool pane

  1. In the dialog box, from the Select a query menu, select your newly created result source.

    In my scenario, I selected the Articles (Site Collection) result source.

Select new result source

  1. Click OK in the dialog box, OK in the Web Part Tool pane, and then save the page. To verify that the configuration is working, enter a query.

    In my scenario, I entered search configuration.

Final search results with new result source

52 results were returned, which is the same number of items that was returned when I tested the query in the result source configuration. Cool, don’t you think?


Now that the Search Results Web Part displays the search results we are interested in, the next step is to make it easier for users to filter these search results. To do this, we'll use refiners, which is the subject of the next blog post. 

 

Next blog post in this series
Plan to use refiners on a search results page