Tag sites with the CoveoSiteFilter managed property
Tag sites with the CoveoSiteFilter managed property
- Step 1: Install the PnP PowerShell module
- Step 2: Give administrative consent to the PnP PowerShell module
- Step 3: Add a custom property to the site property bag
- Step 4: Index the site
- Step 5: Create the
CoveoSiteFilter
managed property - Step 6: Tag other sites with the same custom property value
- Step 7: Configure your SharePoint Online source
SharePoint Online sources have a JSON configuration option that allows you to only index sites that have the CoveoSiteFilter
managed property set to a specific value.
This article explains the procedure to create the CoveoSiteFilter
managed property and how to tag sites in your SharePoint Online tenant.
This procedure is a prerequisite for configuring the JSON configuration parameter in your SharePoint Online source.
Step 1: Install the PnP PowerShell module
Follow the instructions in the PnP PowerShell documentation to install the PnP PowerShell module.
Step 2: Give administrative consent to the PnP PowerShell module
The first time you run the PnP PowerShell module, you need to give it administrative consent to access your SharePoint Online organization.
-
Run the following cmdlet in a PowerShell console with administrative privileges:
Connect-PnPOnline -Url <SPO_SITE_URL> -Interactive
Replace
<SPO_SITE_URL>
with the URL of a SharePoint Online site you want to tag (for example,https://mytenant.sharepoint.com/sites/mysite
).This will launch a browser window and prompt you to log into your SharePoint Online organization.
-
In the browser window, log into your SharePoint Online organization using an account that has administrative privileges.
-
In the Permissions requested screen, click Consent on behalf of your organization, and then click Accept.
Step 3: Add a custom property to the site property bag
There’s currently no way in the SharePoint Online user interface to add a custom property to a site property bag. This has to be done using the PnP PowerShell module.
Run the following cmdlet in the elevated PowerShell console:
Set-PnPAdaptiveScopeProperty -key coveoSource -value <SOURCE_SPECIFIC_VALUE>
Replace <SOURCE_SPECIFIC_VALUE>
with a value that sites indexed in the same SharePoint Online source will share.
For example, you might want to replace <SOURCE_SPECIFIC_VALUE>
with Canada
for all sites that apply to a Canadian audience.
|
Note
You can verify that the property key and value were properly added to the current site property bag by running the following cmdlet in the elevated PowerShell console:
|
Step 4: Index the site
The SharePoint crawling process now needs to index the site to create a tenant-level crawled property named coveoSource
.
To ensure that your changes are picked up during the next scheduled crawl, you should manually request the reindexing of the site.
-
On the site, select Settings, and then select Site settings. If you don’t see Site settings, select Site information, and then select View all site settings.
-
Under Search, click Search and offline availability.
-
In the Reindex site section, click Reindex site.
-
A warning appears. Click Reindex site again to confirm.
The content will be reindexed during the next scheduled crawl.
Step 5: Create the CoveoSiteFilter
managed property
-
In your browser, access your SharePoint Online tenant search schema at
https://<TENANT>-admin.sharepoint.com/_layouts/15/searchadmin/ta_listcrawledproperties.aspx?level=tenant
. Replace<TENANT>
with your tenant name. -
In the Managed Properties section, click New Managed Property.
-
Configure the new managed property as follows:
-
Property name:
CoveoSiteFilter
The SharePoint Online source tagged site indexing option expects the managed property to be named
CoveoSiteFilter
precisely. Make sure the name is spelled correctly with the same casing. -
Type:
Text
-
Main characteristics: Select
Searchable
,Queryable
,Safe
(optional), andToken Normalization
. -
At the bottom of the page, click Add a Mapping.
-
In the Crawled property selection panel, select the
coveoSource
property, and then click OK.
-
-
Click OK to save the managed property.
Step 6: Tag other sites with the same custom property value
You can use the PnP PowerShell module Connect-PnPOnline
and Set-PnPAdaptiveScopeProperty
cmdlets to access and tag as many sites as you want with the coveoSource
custom property value you chose.
|
Note
Being tenant-wide, mapping the |
Step 7: Configure your SharePoint Online source
Once all sites you want to index in the same SharePoint Online source are tagged, configure your source to target the tagged sites.