How to add a custom search vertical to your search results page in SharePoint 2013


This is a blog post in the series, “How to set up a Search Center in SharePoint 2013”. 
In the previous blog post, I showed you how to add and configure refiners to you search results page.  In this post you’ll learn:

 

Using a search vertical in an everyday situation
You might not have heard the term “search vertical” before, but I’m pretty sure you’ve used them several times.  So let me show you what we mean by the term “search vertical.”

I like to ski, so I often search for ski-related content. When I enter the word “ski” in a search engine, I get a wide variety of search results.

Search for ski on bing.com

I am glad to see that there is much information out there on the topic of skiing, but many times I am just looking for great ski-pictures. And this is where search verticals come into play.

On the same search results page, I just click IMAGES, and in an instant my screen is filled with images of people in colorful clothing, racing down white slopes while bathing in sunshine from a clear blue sky.

IMAGES search vertical on bing.com

When I click on IMAGES, I am using a search vertical. Bing has five search verticals: WEB, IMAGES, VIDEOS, MAPS and NEWS.

All search verticals on bing.com

A search vertical filters search results so that only a certain type of search results are displayed. When I clicked on the IMAGES search vertical, the search results were filtered so that only images were displayed.

 

About search verticals in SharePoint 2013
In SharePoint 2013, search verticals are displayed in the Search Navigation Web Part.  There are four default search verticals: Everything, People, Conversations and Videos.

Default search verticals in SharePoint 2013

When users click on one of these search verticals, they are in fact navigating to a new page. For example, the default search results page, the Everything search vertical, uses the results.aspx page.

The Everything search vertical in SharePoint 2013

 When users click on the People search vertical, they are in fact navigating to the peopleresults.aspx page.

The People search vertical in SharePoint 2013

These are the default pages that are used for the four search verticals:

Search vertical Use this page
Everything results
People peopleresults
Conversations conversationresults
Videos videoresults

To view these pages, from the Site settings menu, select Site contents –> Pages.

Search vertical pages in Pages library

The default vertical pages all use these Web Parts:

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

Default Web Parts on search vertical page

The difference between these pages is how the Search Results Web Part is configured. To be specific: the Web Parts are configured to use different result sources.

 

Result sources – why setting limits is a good thing
As I explained in an earlier blog post, a result source specifies the source from where your search results can come from. For example, imagine that your search index is the cube in the image below, where you have four result sources:

  • Result source 1: search results can come from the entire cube.
  • Result source 2: search results can come only from the Bs.
  • Result source 3: search results can come only from the Cs.
  • Result source 4: search results can come only from the Ds.

Search index represented as a cube

So, by limiting from where search results can come from, you can make it easier for your users to find what they’re looking for.

In my internal search center scenario, all search results are list items that represent a type of media file, for example an article, an image or a video. I wanted to create three custom search verticals for three specific types of media files:

  • Art: list items that represent images
  • Video: list items that represent videos
  • Interop: items that represent interop articles (interop articles are a specific type of articles that we produce)

However, before I could start to create these search verticals, I had to create one result source for each custom search vertical. I showed you how to create a result source in an earlier blog article.

 This is how I defined the Art result source.

Query for Art search vertical

Remember, {searchTerms?} (contentclass:sts_listitem) path:http://<path> was the query text of the Article result source that I created earlier. To this, I added AND ContentType:Art

In our lists, we use the site column Content Type to specify the different media files. For example, all images have the value Art for Content Type.

List item with Content Type:Art

 So, by adding AND ContentType:Art  to the query text, only list items that have the value Art for Content Type will be returned in search results.

 Here are the three new result sources I created.

The three search verticals in my internal scenario

Now that I had three new result sources, I could move on to creating the custom search verticals.

 

How to create a custom search vertical
When you create a custom search vertical, the first thing you have to do is to create a page that the search vertical will use. To create a new page, here’s what you should do:

  1.  From the Site Settings menu, select Site contents.

Site contents

  1. Select Pages.
  2. In the Pages library, select the FILES tab –> New Document –> Page.

Select to create a new page

  1. On the Create Page page, enter a Title and a URL Name.

    In my scenario, I entered Art and art.

Enter new page properties

  1. Click Create.

Your new page is displayed in your Pages library.

New page in Pages library

Now that you have a page for your custom search vertical, you can start to create the actual search vertical. Here’s what you should do:

  1.  On the Site Settings page, click Search Settings.

Search Settings

  1. On the Search Settings page, in the Configure Search Navigation section, click Add Link.

Add Link

  1. In the Navigation Link dialog box, in the Title field, enter the search vertical title. This text will appear as the “tab” name on your search results page.

    In my scenario, I entered Art.

Enter Title for search vertical

  1. In the URL field, select Browse and select a page for your search vertical.

    In my scenario, I selected the art page I just created.

Enter URL for search vertical page

  1. Click OK to close the Navigation Link dialog Box.
  2. On the Search Settings page, in the Configure Search Navigation section, select the search verticals that you don’t want to display, and click Delete.

    In my scenario, I deleted the People, Conversations and Videos verticals, so that I was only left with the Everything and the Art search vertical.

Two search verticals

  1. Click OK to save all changes.
  2. In your Search Center, enter a query. On your search results page, your newly created search vertical is displayed.

    On my search results page, the Art vertical was displayed.

Verify that new search vertical is displayed

  1. On your search results page, click on your newly created search vertical, and verify that the URL is the same as you specified in step 4.

    In my scenario, I clicked Art, and verified that the URL was <site>/articles/Pages/art.aspx. I also noticed that 13 search results were displayed.

Verify that new search vertical page is used

  1. On your new search vertical page, select to edit the page, and then to edit the Search Results Web Part.
  2. In the Web Part tool page, click Change query. This will open a dialog box.

Change Query in Search Results Web Part

  1. In the Build Your Query dialog box, from the Select a query menu, select the result source that you created for this search vertical (what we did in the previous section).

    In my scenario, I selected Art result source (Site Collection).

Select result source

  1. Click OK and save the page.

On your new search vertical page, enter a query to verify that the correct search results are displayed.

In my scenario, I entered united airlines again, and noticed that only 11 search results were displayed.  Remember, before I changed the result source in the Search Result Web Part, 13 results were displayed. So my new vertical was working. Nice!

Verify that correct search results are displayed

In my scenario, I added two more search verticals, Video and Interop. And with that, I had completed the Search Center set up.

All search verticals in my internal scenario

 

What you can do after you have successfully set up a Search Center
When you have successfully set up a Search Center, the first thing you should do is to congratulate yourself on a job well done. Nice job!

However, the job usually doesn’t end there. To make the Search Center even more user-friendly, you can change the way search results are displayed, for example to display information that is specific to your company or business. You can read about how to do that in the blog series How to change the way search results are displayed in SharePoint Server 2013.

Comments (38)

  1. Bella_Engen says:

    Hi Karen,

    I am not exactly sure how this is done, but I assume you'll have to modify your master page. See this article for more information: http://msdn.microsoft.com/en-us/library/office/dn205271.aspx

    Hope this helps,
    Bella

  2. Bella_Engen says:

    Hi Omar,

    I’m glad to hear that the series helped you 🙂

    Yes, what you describe is possible. I don’t have any documentation that I can point you to, but if you play around with F12 and the REST response, you can find these values. And to find examples, you can try searching for "sharepoint rest api search return
    json example".

    Hope this helps.

    Bella

  3. Anonymous says:

    Thanks for this post. It is really helpful. I'm trying to display the images only. Can you give me some advice to achieve this?

  4. Bella_Engen says:

    Hi Vikram,

    I'm sorry, but I don't quite understand your question. Could you please elaborate?

    Thanks,
    Bella

  5. Omar Sedano says:

    Hi Bella,
    i have resgistered now in TechNet only to congratulate you for this great series of articles and for the serie :"How to change the way search results are displayed in SharePoint Server 2013".

    It really helped me a lot, well, in fact you made my work xd

    One question, i want to show the number of elements found and the time of searching. Both under the Search Box. Just like Google or something similar.

    Could you tekk me some tips about how i should do it?

    Thanks! And nice job!

  6. Bella_Engen says:

    Hi Paul,

    Happy to hear that you got it to work 🙂

    Bella

  7. Bella_Engen says:

    Hi Anne,

    I am not sure if I have understood your situation, but are you trying display custom properties/values in search results? If so, check out the series "How to change the way search results are displayed" 

    http://blogs.technet.com/b/tothesharepoint/archive/2013/09/03/how-to-change-the-way-search-results-are-displayed-in-sharepoint-server-2013.aspx

    Bella

  8. Bella_Engen says:

    Hi Dave,

    If I understand you correctly, you want to add a search vertical to your global search center. However, you only want people that have access to the search results that you want to display in this vertical to actually see the vertical in in the navigation,
    correct?

    The Search Navigation Web Part doesn’t do security trimming, so the search vertical will be visible to all users in the navigation. But remember that on the search vertical page, search results are displayed in the Search Results Web Part, and this Web Part
    has security trimming. So only people who have access to the content will see search results.

    But, this might not be such a good solution, so you should look into the possibility of setting up a second search center for this content.

    Hope this helps,
    Bella

  9. Bella_Engen says:

    Hi Paul,

    What type of Site Collection do you have? The (Welcome Page) Search results page template is by default available in an Enterprise Search Center Site Collection, which is what I used for this series (http://blogs.technet.com/b/tothesharepoint/archive/2013/10/31/how-to-create-a-search-center-site-collection-and-enable-crawling-of-your-content-in-sharepoint-2013.aspx#HowCreate)

    Bella

  10. Paul D. Fox says:

    When you created the Search Page I see you used a template called (Welcome Page) Search Results. Where did this come from? I don't see it as a default. Did you copy from somewhere else and added a new Layout to the site?

  11. Bella_Engen says:

    Hi Ismail,

    Thanks for the nice feedback 🙂
    I currently don’t have plans to write more about search administration. Is there anything in particular you want to know more about?

    Bella

  12. Bella_Engen says:

    Hi,

    Do you want to display only images in a separate search vertical? If so, there is a default result source called Pictures. Have you tried to use that?

    Bella

  13. Anonymous says:

    Hi KK,

    Yes, you can have a search results that displays only two search verticals. To delete a search vertical, go to Site settings –> Search Settings (under Search). On the Search Settings page, in the Configure Search Navigation section, select the search vertical that you want to delete, and select Delete.

    Hope this helps,
    Bella

  14. Anonymous says:

    Hi Lex,

    Sorry, I won’t be publishing any more blogs on how to use SharePoint search.
    I suggest you contact Microsoft Support with your question.

    Bella

  15. Durval Ramos says:

    Excellent post ! Thanks for sharing

  16. Bella_Engen says:

    Hi Durval,

    Glad you like it 🙂

    Bella

  17. Prasath C says:

    Nice post, thank you.

  18. Dean Gross says:

    Thank you, this will be very helpful

  19. Bella_Engen says:

    Hi Dean,

    Glad to hear that you found the post helpful 🙂

    Bella

  20. kesh says:

    Brilliant post added to my favorites

  21. Yuris says:

    Thanks a lot. That's what I was looking for a week.

  22. Anne Mundy says:

    Hi Bella,

    thanks that makes it clear now.

    Have you ever searched the profile pages for people? I've added some new fields on people's profiles but they are not coming up in the search….any ideas welcome!

    Anne

  23. Ismail Enjreny says:

    As usual you are the best writer on SharePoint Search

    Can you start a series for Search Administration?

    Best Regards

  24. Anon says:

    Thanks, simple but powerful. Gotta love it!

  25. Vikram says:

    Hi, Nice blog post,very illustrative.Can we provide web based contextual search using a common search center?

  26. karen says:

    How can the search box in the master page or homepage be change to vertical navigation instead of dropdown? Thanks,

  27. Doula.K says:

    Great Post

  28. Anonymous says:

    Pingback from SharePoint Search | Share your knowledge

  29. Ashish N. says:

    Good Article. Thanks

  30. David C. says:

    Very nice set of articles Bella! Thanks! For the benefit of others who would like to change the default search vertical to something other than "Everything", Edit the web part of the default search page (/Search/Pages/default.aspx). In the "Properties
    for Search Box" section, check either "Use this site's Search Settings" or "Send queries to a custom results page URL".

  31. Hi Bella says:

    I found it. I created a site collection in an exclusive managed path called "Search". It appears I needed to be their in order to crate the new page for the Search Vertical. So my search site is "http://portal.contoso.como/search"

    Thanks for the great article.

    Paul

  32. Dave says:

    Hi Bella,
    Thanks for all of the great posts.

    I'm trying to figure out a way to create custom verticals for one department that won't be shared with other departments but I can't figure out how to achieve this in a non global fashion. How can I can I set new custom verticals for one department without
    affecting the default search verticals for everyone else? Will this require a second search center?

    Thanks

    Dave

  33. senthil says:

    Nice Article

  34. suman says:

    Very nice post . helped me just in time

  35. pascal says:

    that's awesome, very well explained. Thanks a lot!

  36. Hi Bella,

    I have been searching everywhere but couldn't find anything specific to a result source that is mapped to a file share. Could you show us how it should be done so it can also be setup as part of the search verticals?

    Thanks..

  37. Vikas Katyal says:

    Thank you for the wonderful post, Bella. It helped greatly in one of the S.Rs.

  38. KK says:

    Hi Bella,

    Thank you very much for the wonderful article. I was wondering if we can add different navigation options on the different search results page. For example – a search results page only display 2 search verticals and in a different search results page it display
    4 search verticals. Is this possible?

    KK