Skip to content

Scenarios

This section of the documentation provides some scenario-based recipes for building solutions with the PnP Modern Search Web Parts. It can be confusing to look across the documentation for ways to solve specific needs, so these scenarios may help. Wherever possible, we link back to the core documentation rather than explaining actions in duplicate.

Create a simple search page

We can create a search-driven experience simply by adding the PnP Modern Search Web Parts to a page: PnP Search Box and PnP Search Results.

Set up Managed Properties

In order to use your custom column values as filters in your PnP Modern Search search solutions, those columns must be mapped to refinable manage properties and they must be mapped to Managed Properties.

Build a page with filters

Most search solutions require some filters (aka refiners) to allow the user to filter the initial results.

Create a search page with verticals (on different pages)

Search verticals can be used to selectively search specific content per vertical. Using the SharePoint provider you can use result sources to limit the content returned, or you can add the required KQL in the web part itself. This sample shows how to set up multiple search verticals on different pages.

Create a search page with verticals (within the same page)

Search verticals can be used to selectively search specific content per vertical. Using the SharePoint provider you can use result sources to limit the content returned, or you can add the required KQL in the web part itself. This sample shows how to set up multiple search verticals on the same page.

With the Modern Search Web Parts you can create a simple and useful People Search. You can search or filter people and you can show informations on the People Card when you hover.

Use PnP Results web part as a Department Web Part

With the Modern Search Web Parts you can create a simple and useful Department Web part.

With the Modern Search Web Parts you can show promoted links for important results. They will be configured with query rules in the SharePoint Search Admin Center. Promoted results will show users more informations and direct links about specific, predefined, terms they searching for.

Use query string from url for dynamic results

This scenario describes how to use query string as value in the URL from the current page. You can use URL query string parameters to build dynamic search pages. Use a library with metadata that you can use the query string parameter in the URL.

Setup Results web part to show birthdays

A common request in any intranet is to show birthdays of employees. This scenario describes how to use stock SharePoint search to show birthdays of employees in the search results.

Setup Results web part to show work anniversaries

Showing the work anniversaries of employees is a common request in any intranet. This scenario describes one way to achive this using a sleight of hand trick/cheating as the search index does not contains the information we need.

Connect one Search Results web part to another Search Results Web Part

This scenario describes how to connect more then one results Web Part together. One results Web Part will view the sites, connected with the current HUB site, the other, connected results Web Part, will show the documents from the selected site.