SharePoint24x7 It's all about SharePoint.

1Oct/141

Article – Customizing SharePoint 2013 Results using Result Sources

SharePoint 2013 gives us a very powerful Search platform by integrating the power of FAST Search platform. One of the very useful capabilities of SharePoint Search is the ability to customize to suite to your requirement.

SharePoint 2013 Search allows not only to customize the Content Processing Pipeline but also to customize how search results are queried and displayed in the search result.

In SharePoint 2010 one of the many ways we could customize search result was customizing Search Scopes. A search scope in SharePoint 2010 defines a subset of information in the search index. Users can select a search scope when performing a search to restrict search results to the subset of information that they want. Generally, search scopes consists of specific topics and different content sources that are important and common to users in the organization. Following is a screen capture of how SharePoint 2010 configures it’s default search scopes.

SharePoint 2010 search scopes

In SharePoint 2013 terminology, we don’t have Search Scopes concept anymore and we have Result Sources as a replacement for search scopes. Result source in SharePoint Server 2013 is used to specify a provider to get search results from, and optionally to narrow a search to a subset of those results. Result sources are more powerful than search scopes which we used in SharePoint 2010. Following are the default result sources we get in as part of the default configuration of SharePoint 2013.

SharePoint 2013 Result Sources

SharePoint 2013 default result sources provides:

  • Everything – Local SharePoint results
  • People – Local People results
  • Conversations – Local conversation results
  • Videos – Local Video results

In this article lets explore how we can use Result Sources to customize the search results presentation to provide more user-centric search experience.

Scenario

When users navigate to out-of-the-box Search Center in SharePoint 2013 and execute a search result, it displays all the items which contains/ match the search keyword. Following is an example of a default search result which shows everything including Sites, Pages, Documents, tasks, Calendar items which match with the search criteria.

SharePoint 2013 built-in search result page

What we want to do is, to customize the default search result presentation to meet the following conditions:

  • Search result will display only the content authored by the user who is executing the search query.
  • Search result will display only the Word Documents and will eliminate Sites, Pages, Calendar items and Tasks even if there are matching items.

Solution

We will be customizing SharePoint Search Result Sources to provide the above custom search result presentation experience.

Task 1 – Creating a custom Result Source

  • Navigate to your Search Center. In my case I have a Search Center defined in the URL: http://intranet.team.com/search/
  • Select Settings and Site Settings to navigate to Site Settings pageSite Actions menu
  • Select Search Result Sources from the Site Collection Administration section to navigate to Manage Result Sources pageSite Collection Administration
  • Manage Result Sources page shows all the built-in Result Sources. Click New Result Source to add a custom Result Source.Manage Result Sources
  • Enter a Name for your custom Result Source. Leave Protocol as Local SharePoint. Leave Type and SharePoint Search Result. Click Launch Query Builder button to launch the Build Your Query window.Build Your Query
  • We will be using BASICS tab to build our custom search query. Set Property filter as shown below and click Add property filter button to add it to Query text area. Click Test query button to test the query and observe the SEARCH RESULT PREVIEW.Build Your Query
  • Set Property filter again with the following parameters as shown below and click Add property filter button to add it to Query text area. Click Test query button again to test the query and observe the SEARCH RESULT PREVIEW. Now you can see the effect of our custom search query and how it reduces the result displayed to end-user.Build Your Query
  • Click Save to navigate back to Manage Result Sources page

 

Task 2 – Associating the new Result Source with the Search Center

  • Navigate to your Search Center. In my case I have a Search Center defined in the URL: http://intranet.team.com/search/
  • Select Settings and click Add a page option. Enter a name for the page and click Create.Add a page
  • New page will be in edit mode and you can customize the web parts available in the new page.
  • Edit Search Results web part to associate our new Result Source.Edit Search Result web part
  • Select Change query button and select the newly created custom Result Source from the Select a query drop down and click OK.Edit Search Result web part

    Change Search query

  • Click OK from from the edit web part property page to exit edit web part property page.
  • Click Check it in and Continue to check in the new page
  • Click Publish it to publish the new page.

 

Task 3 – Adding the new page as a search vertical

  • Select Settings and Site Settings to navigate to Site Settings page
  • Select Search Settings from Search section
  • Locate Configure Search Navigation section in Search Settings page. Click Add Link … to add a new navigation link.Add a search navigation link
  • Enter a title for the Title: field. For the URL: field, browse for the the newly created page by using Browse… button. Click OK.Add a search navigation link
  • Click OK to exit Search Settings page

 

Task 4 – Test the new Result Source

  • Navigate to Search Center and perform a search. You will see the new result source being added to search result page.SharePoint 2013 search result with the new result source
  • Select the new result source and see how it applied the conditions we specified to show content authored by the user who is running the search query and to include only Word documents.New result source search result presentation

Posted by Joy