Exploring Search Result Sources In SharePoint Online

The result source in SharePoint specifies the location from which SharePoint search fetches the results. Result source can also be used to specify the protocol used to fetch the results. In addition to all these, we can specify further filter condition by specifying query in the query builder. SharePoint 2010 had Search Scopes which have been deprecated from SharePoint 2013 onward. To bring in more functionality on top of result scope, result sources were introduced in SharePoint 2013.

In SharePoint Online, we can create or manage the existing result sources from the Admin Center by selecting the Manage Result Sources option from the search tab. By default, SharePoint provides 16 out of the box result sources for use with Search.

We can create a new result source as well, by selecting the “New Result Source” option in the above page. This will open up the page where we can specify the result source name and the location from which the search result should be derived. We can either use the local SharePoint results or fetch it from a remote SharePoint instance.

In the Query transform section, we can specify the query that will be used to filter the search results.

You can click on Launch Query Builder to add the query text. Let’s use this result source to get only the JS files within the SharePoint Site. The query text uses KQL (keyword query language) to form the query. Specifying the query as “filetype=JS” will derive a subset of the results which are JS files. In the Search Result Preview section, you can see the sample search results that satisfied the query condition.

In addition to the query, we can also apply the Metadata filter in the property filter section. We can specify the particular metadata values so that only those matching results will come up in the search results.

In the sorting tab, we have the option to sort the search results by a specific metadata property.

The “Test” tab can be used to test the query results by specifying the KQL Query that will fetch the search results satisfying the query condition.

Clicking on "Save" will create the Result Source. Heading back to the Result Sources page, we can see that in addition to the 16 Result Sources provided by SharePoint the newly created Result Source has also been listed out. We also have the option to set it as the default Result Source.

Initially, Local SharePoint Results are used as the default result source. Changing it to our newly created result source, a tick mark will come up against the new result source.

We also have the option to use the newly created result source in Content Search Web Parts. In order to test it out, add the Content Search Web part to the page.

Clicking on Edit Web part will show the web part properties. Click on Change query to go the Content Search Web Part settings page.

In the “Select a query” section we can see that the new result source, JSFiles, has come up in the drop down and has been selected as the default result source.


Thus, we saw how to create a new result source in SharePoint Online and use it with Content Search Web part.