Search results and Content search webparts SharePoint 2013


Search webparts had great improvements in SharePoint 2013. A couple of them are search results and content search webparts in SharePoint 2013.

This article explains how to get search results using search results webpart, Content search webpart and Result sources in sharepoint 2013.

When you look both webparts at first instance you will feel like all the new changes like properties looks similar we will see all those changes while going through the post.

To get search results using these webparts you have to configure the search, have a look at my previous article on Configuring Enterprise Search in SharePoint 2013  to configure the enterprise search.If you learn one of these webparts then another one is quite similar.

Search results webpart:

Search Results Page

Figure:Results page

Click on search results webpart properties to edit the properties of it. It will show the below Figure : Search results webpart properties.

1.Search criteria:

From the Figure:Search results webpart properties, click on Change query button to see what are the various properties in it.

Search-Results-webpart-Basics

From the above figure we can observe that there are five major Tabs under "Build Your Query".

  • Basics
  • Refiners
  • Sorting
  • Settings
  • Test

Apart from above five major Tabs there is one more Tab called "Search Preview Result".

This one of the exiting feature where you can see the results immediately in the preview once you configure all the required properties in Build your query. Which was really missing in the previous versions of SharePoint.Thanks to Microsoft.


Search Results Preview

We will cover one Tab at a time and explore what are ll the new properties available at each Tab of Build your Query.

BASICS Tab :

Basic Tab has two modes once is quick mode other is Advanced mode. By default it will be advanced mode.

We will change the mode to quick mode to explore the properties inside the Basic section of the Build your query.

Basics Tab - Quick Mode:

The basic difference in the quick mode and advanced mode is in quick mode SORTING Tab won't be there, in Build your Query section, it is included in the BASICS-Tab.

Select a query:

From the select query option you can select which type of content you want to search.

The list of values showing in drop is called "Results source"s.  What is Result source?.

Result source: 

Result sources replace “search scopes” in previous SharePoint versions.

Result sources can be thought of as “containers” for search results that hold the results For specific locations are filtered by specific criteria.

Result sources can be defined from SharePoint site settings.

You can click the "Result Source" hyperlink to manage the result sources.

Select a query

Restrict Results by App:

Using Restrict results by app setting you can search the results from a specific site, list or site collection. There is option doesn't restrict by location.

RestricResultsByURL

Restrict by tag:

You can use the restrict by tag option to limit the search results . You have option not to restrict by tag, even you can restrict the details with navigation  and tags.

Sort Results:

There are different options to sort the search results in BASICS-Tab of quick mode. Please see the below Figure.

Basics-SortResults

BASICS Tab- Adavanced Mode:

In the BASICS Tab -Advanced mode has three options. One is to select the query, By default it will local SharePoint Results (system). Other two options are Keyword filter and Property Filter.

Once we select those values and click on the respective Add Keyword Filter and Add Property Filter the Query Text  Text box will get populated automatically, with the help of that you can test the queries to see the preview.


Keyword and Property Filters


In the above Figure i have selected Keyword filter as "Only return lists and libraries", Property Filter Author with contains in this sitecollection. It will create the Query text for you. To see more values related to Property filter see the below Figure.


Property Filter

If you see the above options you will realize that there is lots of potential with this option itself, If you are a developer this will reduce lot of effort for you. But you need to make sure that these results are based on search so these results depends on how your crawl mechanism is running.

To get updated results from this webpart for all these conditions you might require continuous crawl, please make sure it matches your requirement.

Let's move on to other Tab Refiners now.

REFINERS Tab:

Refiners are usually the links on the search engine’s results page, typically in the left navigation which allow the user to further filter the results.We will added REFINEMENT webpart to display these values  you can check in top of the page for reference.

You can in the previous post as well where we have seen different refiners such as

  • Result Type
  • Author
  • Modified Date

You can add you own custom refiners also in the REFINMENT webpart will see that later in the post on how to explore the features of refinement webpart.

SORTING Tab:

In the sorting Tab you have two options based on those options you can change the sorting of the results get by search results webpart.

  • Sort by Properties
  • Ranking Model
Sorting

Sort By:

You can sort by multiple order see the above figure for reference.

In the below Figure where the default sort by is Rank and there are plenty of options to sort your search results which were not available be default in SharePoint 2010 and Fast search option.

Try to gothrough complete list of sort by values.

Metadata-properties

Ranking Model:

You can sort the results using ranking models which are available in the OOB functionality. If you create a custom ranking model for displaying the results, under this option it will show the newly created ranking model you can simply use that newly created ranking model to display the search results.

Sorting-Rankingmodel

Based on the selected Ranking model you have option to promote or demote the search results based various conditions. Here also you can provide multiple conditions to promote and demote the search results functionality.

Sorting-dynamicRanking

SETTINGS Tab:

Settings tab is mainly used for overriding the some of the settings you do at site level or search service level.

You can override Query rules, URL rewriting and Loading behavior of the search results page.

Settings-Tab

Final Tab is coming up, which is the most helpful for the administrators or developers. Let's see what is there below section :).

TEST Tab:

Quickly see the below figure where we are in the TEST tab of Build your query section, based on the various options we have selected so far it will display accordingly in the Query text box.

Because of Test-tab you don't need to Apply from the webpart properties menu and see the preview of the page each and every time, so that way you will save a lot of time while configuring the search results webpart. Thanks one more time for MICROSOFT for providing the TEST option to test the configuration which you have done for the search results webpart.

Search-Results-webpart-Test


By default you will not see all the options in TEST-Tab, to see all options click on Show more hyper link.

In the below figure you can observe that the Search Results Preview showing the less results, because here i have added one more condition.


Search-Results-webpart-Test


So far we have explored all the options of search criteria property in search results webpart.

2.Display Template:

Display templates, new in SharePoint 2013, are HTML files that dictate how items result and their corresponding hover panels display metadata, links, and previews.

There are mainly two types of options for display templates. One is Results Types to display items and use a single template to display items.

Display-Template
Display-Template

If you select the single template to display items, the search results page will display the results like in the below Figure. Here i have chosen the default option.

Display-Templates-Results


If you want to to design the custom display templates click on "Control Display Template" hyper link from  the Display template properties, it will redirect you to"Edit Design Templates" section of Design manager. See the below figure.


Design-Manager

3:Settings:

The properties in the Settings section is where you can restrict the number of results per page. You check or uncheck various check boxes based on various requirement like show ranked results, show promoted results etc. For more options see the below figure.


Settings

Regarding the content search webpart Chri's has written excellent article, so by going through this article will help you understand the Content Search webpart in detail.

Conclusion:

We have explored one of most important webpart in search i.e. Is search results webpart in SharePoint 2013.

So far what we have seen is the configuration of the search results webpart, in coming post we will explore we will see what are the differences in Search Results webpart and Content Search webpart  so please stay tuned.



› Search results web part and content Search web part

About Author

Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for Office Servers and Services MVP and  SharePoint Server.He received the MCC award for his contributions in Microsoft MSDN/TechNet forums.He loves sharing articles, videos and tutorial on SharePoint and Office 365.


If you found this post helpful, please share with your friends!!


Join 5,500 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers