Search – Result Sources

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

What is Result Source?

Result Source (Vertical) is a sub set or particular type of content. They are used to limit search results.

For example, we can use Result Source for a particular:

1. Content Type

2. Sub Site

Default Result Sources

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

image

Central Administration > Search Service Application > Result Sources:

image

What is 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 which controls the results.

image

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.

image

Creating a Result Source

Now we can try creating a new Result Source & Connecting it to the Navigation web part.

image

Our target is to create a Documents result source & connect to the navigation web part.

Following are the steps summary.

image

Step 1: Create new Result Source

Open Central Administration > Manage Service Applications > Search Service Application > Result Sources link

image

Choose the New Result Source link.

Step 2: Modify Query

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

image

Then Launch the Query Builder and enter the following code.

IsDocument:True

image

You can also test the query using Test Query button. Once you are seeing results you are good.

image

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

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.

image

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

http://www.microsoft.com/en-us/download/details.aspx?id=35491

Navigate to All Files > Pages library as shown below.

image

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

image

Close the Designer.

Step 4: Modify Page

We need to modify the new result page & 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 & bring the Search Results Web Part in edit mode.

image

image

Each Result Page will be having pre-configured web parts like:

1. Result web part

2. Refiner web part

3. Navigation web part

Choose the Change Query button & Select our new Result Source as shown below.

image

Click OK to close the web part editing & Save 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 Search Settings link.

image

In the appearing page scroll down to the Configure Search Navigation.

image

Choose an existing link & 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.

image

Please note that the Navigation Link is relative to the site.

Save changes to the dialog & Click Ok to save the navigation items.

Step 6: Testing the link

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

image

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 & testing.

References

http://technet.microsoft.com/en-us/library/jj683115(v=office.15).aspx

http://technet.microsoft.com/en-us/library/jj219620(v=office.15).aspx#Query_vars_temp

Summary

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

Leave a Reply

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