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.
Click on search results webpart properties to edit the properties of it. It will show the below Figure : Search results webpart properties.
From the Figure:Search results webpart properties, click on Change query button to see what are the various properties in it.
From the above figure we can observe that there are five major Tabs under "Build Your Query".
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.
We will cover one Tab at a time and explore what are ll the new properties available at each Tab of Build your Query.
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.
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.
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 sources replace “search scopes” in previous SharePoint versions.
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.
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.
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.
There are different options to sort the search results in BASICS-Tab of quick mode. Please see the below Figure.
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.
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.
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 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
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.
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.
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.
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.
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.
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.
Final Tab is coming up, which is the most helpful for the administrators or developers. Let's see what is there below section :).
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.
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.
So far we have explored all the options of search criteria property in search results webpart.
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.
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.
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.
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.
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.
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.
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.