Limit Search Results to a Specific Content Source in SharePoint 2016
Requirement: HR team wants to setup a dedicated search portal to search a confidential file share.
If its SharePoint 2010, we would have created a search scope and added rules to include only that specific content source to it. Now from SharePoint 2013 on wards search scopes has been replaced by result sources. So, lets see how to create a result source to limit search results only from a specific content source in SharePoint 2016.
Before starting, I've following things configured already:
How to setup 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, lets create it at site level. Here is how you can restrict the SharePoint search to fetch results only from the specific content source.
Configure Search Results Web Part to Use the Result Source:
As the next step, lets configure our search results page to use the result source created in the previous step.
If its SharePoint 2010, we would have created a search scope and added rules to include only that specific content source to it. Now from SharePoint 2013 on wards search scopes has been replaced by result sources. So, lets see how to create a result source to limit search results only from a specific content source in SharePoint 2016.
Before starting, I've following things configured already:
- A content source is created to index the specific file share with name "HR FileShare". Full crawl has been completed already.
- There is a subsite created with "Basic Search center" template to server as a dedicated search center.
How to setup 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, lets create it at site level. Here is how you can restrict the SharePoint search to fetch results only from the specific content source.
- Login to the search center site created. Click on Settings gear >> Site Settings >> Result Sources link under the "Search" Group
- On the Manage Result Sources page, click on "New Result Source" link
- 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.
- In the query builder popup: In 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.
- Fill the value of your content source name. In my case it was "HR FileShare" then click on "Add property filter" button. Click OK to Save and close the Query Popup.
- You can manually Enter the Query as well to limit search results. Click "Save" to finish creating result source.
Configure Search Results Web Part to Use the Result Source:
As the next step, lets configure our search results page to use the result source created in the previous step.
- Navigate to your Search Center site and then search results page (E.g. http://intranet.crescent.com/HRSearch/results.aspx) >> Click on Settings Gear >> Edit Page
- Click on edit the Search Results Web Part and click the Change query button.
- 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 "Stop Editing this page" button for search results page.
That's all! Now try entering some search query and verify the results are only from a particular content source.
No comments:
Please Login and comment to get your questions answered!