Dealing with updates to the Search Schema in SharePoint Online - aka a Full Reindex - part 1
Resently I have to update a RefinableString on a tenant, as it was acidentially mapped to both the Text only property and the TaxId property

Thus the RefinableString contains two "items", the text only first (in green) and then the Term Store based identifier

When this RefinableString is used as a Refiner, then the double value in the RefinableString causes the Refiner to "stammer":

The quick fix is to create a custom Refiner Layout that strips away the first value for that particular RefinableString.
But how about the long term solution? Well, it is pretty obvious: we just update the RefinableString in the Tenant Level Search Schema, and wait for the Search Index to pick out the change, DONE !
WRONG !
For that to work we would have to wait for the Full Reindex to run, and that option was removed when we moved to SharePoint Online.
What are we going to do then?
When we update a List item or a document that is using the metadata field in question then the search index is updated and the value in RefinableString08 will be updated according to the new mapping.
But a List Item or document that is not updated will keep the old value in the Search Index until the List/Library or Site is reindexed, which will require us to request a reindexing.

OK, so we just have to find the sites that already is using the site or list column that is connected to the crawled property, right?
Correct, and there are at least 3 ways to do that:
Just brute force by requesting a reindexing for each and every site in you tenant
Use Search to locate every site where the RefinableString is used and trigger a reindex request for the site.
Use Search to locate every list or library where the RefinableString is used and trigger a reindex request for the list/library.
Number 1 should be avoided in most cases, for performance reasons.
As we are trying to minimize the impact of the reindexing we should go with option 3 as often as possible as there is absolutely no reason to reindex a list or library what doesnt contains the items we are trying to update.
But how do I use Search to find the libraries that contains the problematic items, my account does not have access to all sites in the tenant?
That is correct, or at least I hope so, because you really shouldn't have access to everything, at least not in a Production environment.
There are multiple ways to solve this issue, like:
1) Using a App Registration to run the search and update the Lists/Libraries. I see this as an obvious solution for smaller tenants and very limited updates. Token renewal and timeouts could be an issue with this approach.
Mikael Svenson had a script for that, but it has been taken down: How to trigger a full re-index in SharePoint On-line
2) Create a Azure package, including a Managed Identity, to run the search and update. I see this as the solution for larger tenants or situtations where reindexing is expected to be requested multiple times.
Part 2 of this blog post will be a description of option 2
List of cases where a Full Reindexing is required : Manage the search schema in SharePoint Server - SharePoint Server | Microsoft Learn
Likewise you might have to do a "Full Reindexing" when you have updated the Label on a Term connected to Search. Yes, the change with propergate to the HiddenTaxonomyList on the various site eventually, but that does not cause the item to be reindexed and you will see the old value for that Term label until the item is updated ...... which might never happen.



Comments