SharePoint

Edit SharePoint site search verticals

On a SharePoint site, site admins can customize search verticals that are used when searching on the site.

In this blog post we are going to see what type of customizations site admins can do and how to do it.

Content

  1. What are search verticals
  2. Edit a default search vertical
    1. Name
    2. Query
      1. Standard query
      2. Use profile query variables
      3. Use query string variables
    3. Filters
  3. Create a new vertical
  4. Conclusion
  5. References

What are search verticals

Search verticals are tabs on the search result page that show results of a specific type or from selected sources. For example, the Files vertical only shows files matching the search query (it won’t show list items for example).

Site level search verticals are only used when searching within a specific site scope.

Site level search verticals are not used when search on the Organization scope.

Edit a default search vertical

By default, each site has the following 5 search verticals:

  • All
  • Files
  • Sites
  • News
  • Images

To access and open the edit pane of a default site level search vertical, perform the following steps:

  1. Access the site settings page: “your site url”/_layouts/15/settings.aspx
  2. Click on “Search insights and configuration” in the Microsoft Search category
  3. Click on the “Verticals” tab
  1. Double click on the vertical you want to edit
  2. Click on the “Edit” button

Name

First, let’s edit the Name of a vertical (we will use the ‘News’ vertical as example).

To do so:

  1. Click on the “Edit” link below the name. Then select “Create a custom name”:
  1. Click on “Review” and “Update vertical” and finally “Done”:

Query

Standard query

A query rule can be added (using KQL) to limit the scope of a vertical.

Let’s define a simple query rule for a vertical.

Let’s say that we want the “Department News” vertical to show only news with a specific title.

To do so:

  1. Click on “Edit” below the “Rules” menu:
  1. Add your KQL query in the dedicated text box:
  1. Save your modification just like you did for the title modification.

In this example the “Department News” vertical will only show news with a name starting by “Welcome”.

Use profile query variables

Profile query variables can be used to contextualized search results to the signed-in user.

In our example, we want the “Department News” vertical to show only news modified by the signed-in user.

To do so:

  1. Add the following KQL query to the dedicated text box: ModifiedBy:{Profile.names.displayName}:

You can find the profile resources that you can use here: profile resource type.

Use query string variables

Query string variables allow you to customize search results by adding key-value pairs to the search URL.

In our example, we want want to show news only with a specific Topic Header.

To do so:

  1. Add the following KQL query to the dedicated text box: RefinableString00:{QueryString.topic}

Notice that we had to map the TopicHeader property to a managed property to use it in the query rule.

  1. Use the following search URL: https://sampletenant.sharepoint.com/sites/Demosite/_layouts/15/search.aspx/sitenews?topic=“New joiner”&q=welcome

Filters

Filters can be used to refine results of a search query.

Some filters are available by default:

Let’s add a custom filter to the “Department News” vertical.

  1. Click on “Edit” below the “Filters” menu:
  1. Click on “Add a filter”:
  1. You can select the property to use for the filter. In our example, let’s select the managed property we used on the previous chapter and click on “Next”:

In our example, we have selected a Text property but you can also create DateTime filters.

  1. Define a name and choose if you want users to select single or multiple values and click on “Add”:
  1. Do not forget to validate the new filter by clicking on “Update vertical”.

Create a new vertical

All the modification that we made on the “News” vertical can be made on a fully custom vertical. You can just click on “Add” in the vertical menu to create a new vertical:

Once you have completed the configurations, do not forget to enable your vertical:

Conclusion

In this blog post we have seen the configurations that it is possible to make on site-level search verticals.

As you will see, any modification you make on verticals can take several minutes to show up on the search page (more than one hour sometimes in my experience). So here is a little tip for you: append cacheclear=true at the end of your search URL. With that, changes made on a vertical can be visible in a few minutes!

References

Leave a comment