Mikael Svenson wrote a cool script which will iterate all site collections, sites and sub-sites on your tenant to force a trigger of re-indexing / full crawl of all items on the next crawl.

In SharePoint Online we cannot force a full crawl via the admin user interface and thus have to iterate all sites and set a property in the property bag to accomplish the same task:

function processWeb($web) {

 $subWebs = $web.Webs
 $clientContext.Load($web) 
 $clientContext.Load($web.AllProperties)
 $clientContext.Load($subWebs)
 $clientContext.ExecuteQuery()

 Write-Host "Web URL:" $web.Url -ForegroundColor White
 if( $enableAllManagedProperties -ne "skip" ) {
 Set-AllManagedProperties -web $web -clientContext $clientContext -enableAllManagedProps $enableAllManagedProperties
 }

 [int]$version = 0
 $allProperties = $web.AllProperties
 if( $allProperties.FieldValues.ContainsKey("vti_searchversion") -eq $true ) {
 $version = $allProperties["vti_searchversion"]
 }
 $version++
 $allProperties["vti_searchversion"] = $version
 Write-Host "-- Updated search version: " $version -ForegroundColor Green
 $web.Update()
 $clientContext.ExecuteQuery()

 foreach ($subWeb in $subWebs)
 {
 processWeb($subWeb)
 }
}

This is needed for several search schema modifications, for example when you map crawled properties to managed properties.

The script also has a function to enable population of the ManagedProperties managed property for use with the SharePoint 2013 Search Query Tool v2.

You can download the script here: https://github.com/wobba/SPO-Trigger-Reindex

Recent Insights

Microsoft 365 Capacity: SharePoint Online & One Drive Boundaries & Limits

We’ve got two official languages in Canada: French & English. SharePoint Online Multilingual Support plays an important role in presenting the right language to the right user. In this blog post we outline the features, and some of the challenges we’ve faced in building Modern Multilingual SharePoint Online sites.

read more

Matthew Stark

Matthew Stark is the founder of Making Things Work, has over 16 years experience in the enterprise Information Technology space, is an avid sailor, hockey fan, and a proud father of one.