Result Sources in SharePoint 2013

Result Sources

In this article we can explore the Result Sources in SharePoint 2013 Search.

Result Source

Result Source (Vertical) is a sub set or specific type of content. They are used to limit search results.
For example, we can use Result Source for a specific:

  1. Content Type
  2. Sub Site

Default Result Sources

SharePoint 2013 has 16 pre-configured result sources. The default one is Local SharePoint Results as in the following:

Result Resources

The following shows what you get when you open "Central Administration" and select "Search Service Application" > "Result Sources":

Service Application

Inside the Result Source

We can closely examine a Result Source. Click on the Local Video Results result source. You will be taken to the page where it shows a Query Transform that controls the results.

Query Transform

The Query Transform text is below:
{searchTerms?} {?path:{Scope}} {?owstaxIdMetadataAllTagsInfo:{Tag}} (ContentTypeId:0x0120D520A808* OR (SecondaryFileExtension=wmv OR SecondaryFileExtension=avi OR SecondaryFileExtension=mpg OR SecondaryFileExtension=asf OR SecondaryFileExtension=mp4 OR SecondaryFileExtension=ogg OR SecondaryFileExtension=ogv OR SecondaryFileExtension=webm))
The searchTerms parameter represents the user-query-terms. The remaining text checks for Content Type Id and File Extensions. We can also create custom query transforms.
For more information on Query Transform you can check References section.
Each Result Source can be connected to the Search Navigation web part.

Navigation Web PArt

Creating a Result Source

Now we can try creating a new Result Source and Connecting it to the Navigation web part.
Our target is to create a Documents result source and connect to the navigation web part.

Documents

The following are the steps summary:

Summry of Result Resource

Step 1: Create new Result Source

First open Central Administration then seelct "Manage Service Applications" > "Search Service Application" then click the "Result Sources" link.

Search Service Application

Choose the New Result Source link.

Step 2: Modify Query

In the page that appears, enter the name for the Result Source as Docs.

Edit Result Resource

Then Launch the Query Builder and enter the following code.

IsDocument:True

Query Building

You can also test the query using the Test Query button. When you see the results you are good.

Note

We are using the Keyword Query Language (KQL) syntax to filter the result. The term {searchTerms} will be the user input keywords. Please ensure you have enough documents to satisfy the results.

Step 3: Create Page

Each Result Source should be connected with a Result Page. To create a new page, open SharePoint Designer 2013 and navigate to your Enterprise Search Center site.

Note

If you do not have SharePoint Designer 2013 installed then you can download it from:

SharePoint Designer 2013

 

Navigate to "All Files" then select the "Pages" tab as shown below.

Page Library

Copy and Paste the results.aspx and rename the new file as documentresults.aspx.

document image

Close the Designer.

Step 4: Modify Page

We need to modify the new result page and choose our new result source. Inside SharePoint navigate to the new documentresults.aspx. In my case the URL was:

http://server/esearch/Pages/documentresults.aspx

Choose the Edit Page option and bring the Search Results Web Part into edit mode.

Edit in Search Result

Note

Each Result Page will have a pre-configured web part like:

  1. Result Web Part
  2. Refiner Web Part
  3. Navigation we part

Choose the Change Query button and select our new Result Source as shown below.

Building Query

Click OK to close the web part editing and save the changes to the page.

We are now ready with the following:

  • Result Source
  • Result Page

We need to create the Navigation Link next.

Step 5: Create Navigation Link

From the Enterprise Search Center choose Site Settings. Then choose the Search Settings link.

Search Settings

In the page that appears scroll down to the Configure Search Navigation.

Configure Search Navigation

Choose an existing link and click the Edit button to understand the properties. Then click on the Add Link to create our new navigation link. Enter the Name and Navigation Link appropriately.

Navigation Link

Please note that the Navigation Link is relative to the site. Save changes to the dialog and click Ok to save the navigation items.

Step 6: Testing the link

Type your new search keyword and click on the newly appeared Docs link.

Docs

You can see that the Results are filtered to show only document items. You can also see the Result URL has changed to http://hpvm/esearch/Pages/documentresults.aspx

This confirms our Result Source creation and testing.

References

 

Summary

In this article we explored Result Sources in SharePoint 2013 Search with an example. In advanced scenarios, I recommend you refer to the Keyword Query Language (KQL) and FAST Query Language (FQL) to create complex search verticals.