Create a SharePoint Search page with PnP Modern Search

PnP Modern Search webparts are great for creating a nice search experience using metadata to filter the results. This video is part of a series explaining how to build a controlled document system and covers the configuration in SharePoint and creating a search page using PnP Search webparts.

In this video, I demonstrate how to:

  • Map Site Columns to Search Managed Properties
  • Setup PnP Modern Search
  • Search Box web configuration
  • Search Results webpart configuration
  • Search Filter webpart configuration

To get started, you can download the latest PnP Modern Search build and add it to your SharePoint App Catalog. You will need to get consent via an Entra App Registration to access the Microsoft 365 Graph API from your administrator.

SharePoint Managed Properties are used to map metadata columns (use Site Columns) to the Search Schema so they can be used in PnP Search. It is common for people to create Library columns rather than Site Columns, in which case you need to jump through a few more steps to create Crawl Properties first. Note that the schema is not populated with data until after a crawl is run.

In PnP Search I configure the Query Template on the PnP Results webpart to get document results from my Published Document Library only. Replace the path in the template with your library path.

{searchTerms}
path:"https://tenantname.sharepoint.com/sites/DemoControlledDocs/PublishedDocs"
IsDocument:True

In the PnP Filter webpart I have configured filters using the refinable strings I configured in the Search Schema. Note that these are not in the pick list if you haven’t added them to the Selected Properties in the PnP Results webpart.

Once I have connected the Search Box to the Results webpart and the Results webpart to the Filter webpart, I get a page that lets me search only the published controlled documents with metadata tag filtering.

There are many other use cases for PnP Modern Search including policy libraries, news centres, knowledge bases, portals for client information, and many other document management requirements. Results types can include pages, news, events, sites, list items, documents and people results.

PnP Search is incredibly flexible. It supports custom display templates allowing you to display metadata in the results, for example published dates, department details, statuses etc.

Huge thank you to the community who develop this awesome collection of webparts enabling us to take SharePoint to the next level.


Discover more from SharePoint Moments

Subscribe to get the latest posts sent to your email.

Leave a comment