Limit Search Results to a Specific Content Source in SharePoint 2016

Requirement: The HR team wants to set up a dedicated search portal to search for confidential file share.

If it was SharePoint 2010, we would have created a search scope and added rules to include only that specific content source. From SharePoint 2013 onwards, search scopes are by result sources. So, let’s see how to create a result source to limit search results only from a specific content source in SharePoint 2016.

Before starting, I have the following things configured already:

  • A content source is created to index the specific file share with the name “HR FileShare”. The full crawl has been completed already.
  • There is a subsite created with a “Basic Search Center” template to serve as a dedicated search center.

How to set up a Search Result Source to Limit results to a Content Source?

Result Sources can be created on three different levels: Search Service Application, site collection, and site. For our requirement, let’s create it at the site level. Here is how you can restrict the SharePoint search to fetch results only from the specific content source.

  1. Login to the search center site created. Click on Settings gear >> Site Settings >> Result Sources link under the “Search” Group.
  2. On the Manage Result Sources page, click on the “New Result Source” link
  3. In Add Result Source page, provide a Name to the Result Source and optionally a description. Leave the option buttons for Protocol as “Local SharePoint” and Type as “SharePoint Search Results”. Click on the “Launch Query Builder” button.
    sharepoint 2013 search result limit - Add result source
  4. In the query builder popup: In the Property filter drop-down select ” – Show All Managed properties – ” and then click on property filter again, you’ll have a property called “ContentSource”, select it. And then, select Equals as a condition and Manual Value as the value selector. 
  5. Fill in the value of your content source name. In my case, it was “HR FileShare” then click on the “Add property filter” button. Click OK to Save and close the Query Popup.
    sharepoint search result limit - set result source query
  6. You can manually Enter the Query as well to limit search results. Click “Save” to finish creating the result source.
    sharepoint 2016 search content source result source Query Transform

Now that you have created the Result Source ready. Next, you need to configure your search results page to use this result source.

Configure Search Results Web Part to Use the Result Source:

As the next step, let’s configure our search results page to use the result source created in the previous step.

  1. Navigate to your Search Center site and then search results page (E.g., >> Click on Settings Gear >> Edit Page
  2. Click on edit the Search Results Web Part and click the Change query button.
    search results web part change query
  3.  For “Select a query,” choose the result source you created. In my case, it is “HR FileShare” I created earlier. This will set the filter on the search results web part. Click OK to save your changes, and then click on the “Stop Editing this page” button for the search results page.
    set search results page result source

    That’s all! Now try entering some search queries and verify the results are only from a particular content source.

    Salaudeen Rajack

    Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

    Leave a Reply

    Your email address will not be published. Required fields are marked *