Skip to content

Initial Config

These steps will give users a basic guide on using the search results web part along with the Mercury Templates. For more information PnP - Search Results Web Part.

Prerequisites - 'Modern Search Library' and 'PnP Modern Search - Search Web Parts - v4' must be installed as an app on the site they are to be used.

1. Add the PnP - Search Results web part to a page.

From the web part gallery add 'PnP - Search Results' to a page and open the property pane configuration panel.

2. Extensibility Configuration.

In the web part property panel go to page 4.

Under 'Extensibility Configuration' click the 'Configure' button. A panel will open with the option to add a custom extensibility library.

Note

The Manifest GUID for the custom library can be found in the library's {libraryName}.manifest.json file.

Property Value
Name/ Purpose Mercury Extensibility Library
Manifest GUID 8240ad86-d19b-4ac2-8363-c8b7909a172d
Enabled/ Disabled Enabled

Once all values have been provided click save.

3. Search Query

Return to page 1 of the property panel.

Under 'SharePoint Search' using the query controls, search for the content to be displayed in a template.

To return news, documents or events paste one of the example queries below into the 'Query Template' box and click apply:

{searchTerms} PromotedState:2
{searchTerms} (FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:ppt OR FileExtension:pptx OR FileExtension:pdf) (IsDocument:"True" OR contentclass:"STS_ListItem")
{searchTerms} contentclass:STS_ListItem_Events

Note

See the Keyword Query Language (KQL) documentation for further guides on available syntax.

4. Selected Properties

Expand the 'Selected Properties' dropdown. This will display a list of SharePoint managed properties from returned results.

Below are the recommended properties that should be used to display relevant data within a chosen template:

AuthorOWSUSER,
ContentTypeId,
Created,
CreatedBy,
Description,
EditorOWSUSER,
FileExtension,
LikeCount,
MercuryArticleDateOWSDATE,
ModifiedOWSDATE,
MercuryContentType,
NormSiteID,
owstaxIdMercuryBusinessUnit,
owstaxIdMercuryCategory,
owstaxIdMercuryDepartment,
owstaxIdMercuryTypeOfContent,
PictureThumbnailURL,
SiteID,
SiteTitle,
SPWebUrl,
Title,
UniqueID,
ViewsLifeTime,
WebId

Add any other custom managed properties as required.

Note

Any properties to be used with in 'Layout Slots' should be selected in 'Selected Properties'.

5. Layout Slots.

Under 'Layout Slots' click the 'Customise' button. This will open a panel that can provide placeholder variables to be used within templates.

A basic list of variables can be found below. This may vary for each template, check the specific template documentation for which variables can be used for the selected template in the next step.

  • Slot Name - The name of the variable to be used with in the display template.
  • Slot Field - The data source or selected property to be used as the value for the variable.
Slot Name Slot Field
Title Title
User AuthorOWSUSER
Date MercuryArticleDateOWSDATE
Tags owstaxIdMercuryBusinessUnit

Once all required slots variables have been added click save.

6. Layout

Go to page 2 of the property panel. Under 'Available Layouts' select the layout required.

Note

On occasion the user may not be able to see the custom layout options in the list of available options, even after enabling the custom library within the web part. Switch between one of the default layouts and this should refresh the list of layouts, this should then display the custom layout options - if issue still occurs contact an admin.

7. Layout Options

Once a layout has been selected, the relevant layout options for the selected layout will be displayed under 'Layout Options' at the bottom of page 2.

From the list of display templates select the template to be used.

Set the 'Items Per Row' to an appropriate number.

Further documentation for each available template can be found under the inividual template documentation.