SharePoint 2013: How To Create Custom Search Verticals

What are Search Verticals

In SharePoint 2013 Search Vertical are displayed in the Search Navigation Web Part on Search Center. SharePoint 2013 provides us four Search Verticals OOTB; namely Everything, People, Conversation, and Videos. Each of these verticals is mapped to a specific page to display the results returned by the queries and when Search Users click on any of these verticals they are navigating to the respective mapped pages with the vertical they clicked on.

everything

For example: Search Vertical Everything uses Results.aspx page to display the results returned by the query. In a similar fashion People vertical usesPeopleResults.aspx, Conversation vertical uses ConversationResults.aspx,Video vertical uses VideoResults.aspx.

All these pages used by the different Search Verticals can be located under Page Library on Search Center Site

pages

Each of these vertical pages use the following four Web Parts to render results returned by the user queries:

  1. Refinement Web Part
  2. Search Box Web Part
  3. Search Navigation Web Part
  4. Search Results Web Part

Part

I hope by now you have a fairly good idea on “What are Search Verticals?”

In this article we are going to create new a Search Vertical for our Search Center that will be showing all the documents (Only Documents) Authored or Co-Authored by me.

Business Scenario:

  1. Search must be able to show all the documents Authored or Co-Authored by me
  2. All the search results must be shown under different vertical on the Search Center
  3. Only documents must be included in the search results

Prerequisites:

  1. Search Service Application Instance must be created and configured
  2. Content Sources must be created as required
  3. Full Crawl must be executed once at least on each of the Content Source
  4. Search Center Site must be created & configured as required

On a similar line we can create our own Search Verticals.

We need to perform the  following steps to get a new Search Vertical Up and Running.

  1. Create Result Sources (One per vertical)
  2. Create new Search Vertical page to display results
  3. Configure Search Navigation

We will start our journey by creating the required Result Source for the new search vertical

Go to Site Settings,

Settings

Go to Search >> Result Sources,

Sources

Create new Result Source by clicking New Result Source link,

link

Enter Name and Description.

Choose Local SharePoint as Protocol,

Click in Launch Query Builder Button to launch Query Builder screen where we can specify the relevant query for the Result Source,

Source

Source

Choose Property Filter as needed, based on the business scenario we have we will choose Property Filter as Author and Value as Name of the user who run the query then Property Filter as IsDocument and Value as 1.

Setting Document Property Filter to 1 is a must if you want to display only documents as the part of the search results for this newly created vertical.

property

Click Add property filter Button to add the properties to the Query Text.

Once we are done with configuring the Query we need to test the Query by clickingTest Query Button.

Search Result Preview Panel on the left which will display all the results returned by the query we just configured.

Preview

Click OK.

ok

With this we are done with the creation of Result Source for the new Search Vertical.

Now we will create a new Search Vertical Page to display results retuned by the Result Source that we have just created.

Go to Site Contents

Contents

Go to Pages Library,

Library

Click new item or Go to Files Tab >> New Document,

Choose Page Template to create a new Search Page.

Page
Edit

Once the page is added, Edit the page,

edit

Locate Search Results Web Part and edit its properties,

properties

Edit web

In Web Part Properties click on Change Query Button to launch a query builder,

properties

Choose My Documents Result Source from Select a query Dropdown box,

Dropdown

Click Test Query Button to test the query translated by the Result Source selected under Select a query,

Search Result Preview Panel on the left will display all the results returned by the query we just configured.

With this we are done with creation a new Search Result Page.

It is time now to Configure Search Navigation to include new Search Vertical on the Search Center

Go to Site Settings,

Go to Search >> Search Settings.

Dropdown

Click on Add Link under Configure Search Navigation,

Navigation

Enter Title as My Documents,

Click on Browse Button,

Browse

Select MyDocuments.aspx Page from Page Library,

Library

Click OK,

This will create a new Search Vertical on the Search Center with name My Documents.

Documents
Documents
Finally we need to test this new Search Vertical.

Currently I am logged in as sp\spdeveloper

Go to Search Center,

Enter Search Query in our case which is *.pdf to return all the documents with the extension .pdf.

Everything Search Vertical will show all the PDF documents returned by the query,

query

But My Document Search Vertical will show only those PDF documents which are Authored or Co-Authored by me,

documents

documents

Creating new Search Verticals can be helpful in scenarios where a business user needs to filter out the results returned by the queries under different names by limiting the results based on the Result Sources.

Hope this will help someone in need.

 
Read more articles on SharePoint: