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, Videos. Each of these verticals 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.
https://howtodowithsharepoint.files.wordpress.com/2014/06/39.png?w=450&h=77
For example: Search Vertical Everything uses Results.aspx page to display the results returned by the query. In the similar fashion People vertical uses PeopleResults.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
https://howtodowithsharepoint.files.wordpress.com/2014/06/110.png?w=450&h=261
Each of these vertical pages uses following four Web Parts to render results returned by the user queries:
- Refinement Web Part
- Search Box Web Part
- Search Navigation Web Part
- Search Results Web Part
https://howtodowithsharepoint.files.wordpress.com/2014/06/212.png?w=450&h=206
Hope by now you got a fairly good idea on “What are Search Verticals?”
In this article, we are going to create new Search Vertical for our Search Center that will be showing all the documents (Only Documents) Authored or Co-Authored by me.
Business Scenario:
- The search must be able to show all the documents Authored or Co-Authored
- All the search results must be shown under different vertical on the Search Center
- Only documents must be included in the search results
Prerequisites:
- Search Service Application Instance must be created and configured
- Content Sources must be created as required
- Full Crawl must be executed once at least on each of the Content Source
- Search Center Site must be created & configured as required
Along similar lines, we can create our own Search Verticals.
We need to perform following steps to get a new Search Vertical Up and Running.
- Create Result Sources (One per vertical)
- Create new Search Vertical page to display results
- Configure Search Navigation
We will start our journey by creating the required Result Source for the new search vertical.
Go to Site Settings
https://howtodowithsharepoint.files.wordpress.com/2014/06/42.png?w=450&h=239
Go to Search >> Result Sources
https://howtodowithsharepoint.files.wordpress.com/2014/06/52.png?w=450&h=227
Create new Result Source by clicking New Result Source link
https://howtodowithsharepoint.files.wordpress.com/2014/06/62.png?w=450&h=75
Enter Name and Description.
Choose Local SharePoint as Protocol
Click Launch Query Builder Button to launch Query Builder screen where we can specify the relevant query for the Result Source
https://howtodowithsharepoint.files.wordpress.com/2014/06/72.png?w=450&h=249
https://howtodowithsharepoint.files.wordpress.com/2014/06/82.png?w=450&h=93
Choose Property Filter as needed, based on the business scenario we have we will choose Property Filter as Author, Value as Name of the user who run the query, Property Filter as IsDocument and Value as 1.
Setting IsDocument 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.
https://howtodowithsharepoint.files.wordpress.com/2014/06/92.png?w=450&h=305
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 clicking Test Query Button
Search Result Preview Panel on the left will display all the results returned by the query we just configured.
https://howtodowithsharepoint.files.wordpress.com/2014/06/102.png?w=450&h=308
Click OK
https://howtodowithsharepoint.files.wordpress.com/2014/06/112.png?w=450&h=107
With this, we are done with the creation of Result Source for the new Search Vertical
Now we will create new Search Vertical Page to display results returned by the Result Source that we have just created.
Go to Site Contents
https://howtodowithsharepoint.files.wordpress.com/2014/06/122.png?w=450&h=405
Go to Pages Library
https://howtodowithsharepoint.files.wordpress.com/2014/06/132.png?w=450&h=228
Click New item or go to Files Tab >> New Document
Choose Page Template to create a new Search Page
https://howtodowithsharepoint.files.wordpress.com/2014/06/142.png?w=450&h=143
https://howtodowithsharepoint.files.wordpress.com/2014/06/152.png?w=188&h=300
Once the page is added, Edit the page
https://howtodowithsharepoint.files.wordpress.com/2014/06/162.png?w=450&h=131
Locate Search Results Web Part and edit its properties
https://howtodowithsharepoint.files.wordpress.com/2014/06/172.png?w=450&h=300
https://howtodowithsharepoint.files.wordpress.com/2014/06/182.png?w=450&h=174
In Web Part Properties click on Change Query Button to launch a query builder
https://howtodowithsharepoint.files.wordpress.com/2014/06/192.png?w=243&h=300
Choose My Documents Result Source from Select a query Dropdown box
https://howtodowithsharepoint.files.wordpress.com/2014/06/202.png?w=450&h=306
Click Test Query 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 creating a new Search Result Page.
It is time now to Configure Search Navigation to include new Search Vertical in the Search Center
Go to Site Settings
Go to Search >> Search Settings
https://howtodowithsharepoint.files.wordpress.com/2014/06/213.png?w=450&h=294
Click Add Link under Configure Search Navigation
https://howtodowithsharepoint.files.wordpress.com/2014/06/221.png?w=450&h=198
Enter Title as My Documents
Click Browse Button
https://howtodowithsharepoint.files.wordpress.com/2014/06/231.png?w=450&h=230
Select MyDocuments.aspx Page from Page Library
https://howtodowithsharepoint.files.wordpress.com/2014/06/241.png?w=450&h=245
Click OK
This will create a new Search Vertical on the Search Center with name My Documents.
https://howtodowithsharepoint.files.wordpress.com/2014/06/251.png?w=450&h=171
https://howtodowithsharepoint.files.wordpress.com/2014/06/261.png?w=450&h=137
Finally, we need to test this new Search Vertical.
Currently logged in as sp\spdeveloper
Go to Search Center
Enter Search Query 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
https://howtodowithsharepoint.files.wordpress.com/2014/06/271.png?w=450&h=396
But My Document Search Vertical will show only those PDF documents which are Authored or Co-Authored
https://howtodowithsharepoint.files.wordpress.com/2014/06/281.png?w=450&h=218
https://howtodowithsharepoint.files.wordpress.com/2014/06/291.png?w=450&h=269
Creating new Search Verticals can be helpful in the scenarios where the 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.