How to restore Spotlight search of Rich Text files

If you’re running Catalina or any version of Big Sur prior to 11.3, your Mac’s Spotlight search won’t work on Rich Text (RTF) documents. This was a bug introduced most probably in build 319.60.100 of RichText.mdimporter (in System/Library/Spotlight) which shipped with Catalina 10.15.6, and was perpetuated in more recent builds included in Big Sur, until it was finally fixed in build 326.11 in the 11.3 update.

Curiously, although this bug results in the contents of all RTF files being completely omitted from Spotlight’s indexes, it doesn’t affect RTFD documents, although they too include Rich Text files which have been correctly indexed throughout.

I’ve checked the matching Catalina Security Update 2021-002, released at the same time as Big Sur 11.3; although that includes updates to five other mdimporters, it doesn’t include a new version of RichText.mdimporter, implying that this bug still hasn’t been fixed in Catalina. For those using Catalina, the only way to fix this bug is therefore to upgrade to Big Sur 11.3.1.

Updating to 11.3 fixes the bug in RichText.mdimporter, but that will only index newly created or changed Rich Text files. Those Rich Text files which have been created or changed between 15 July 2020 (release of the 10.15.6 update) and 26 April 2021 (release of the 11.3 update) still won’t be added to a volume’s Spotlight indexes unless you force those indexes to be rebuilt for that whole volume.

Forcing rebuild of a volume’s Spotlight indexes

To get best value from your Spotlight searches, you should force a rebuild of the indexes on each volume on which you store Rich Text files whose contents you want included in searches. That normally includes at least your Data volume.

To force a volume to be re-indexed, open the Spotlight pane and select its Privacy view. Click the + button at the foot, select the volume and add it to the list. Pause thirty seconds or so, select that volume in the list, and click the – button to remove it from the list. You don’t normally need to close the pane or restart between adding and removing the volume.

If you prefer, you can instead use the mdutil command in Terminal. The command
mdutil -E /
erases the indexes on your Data volume and forces them to be rebuilt, and you can use the same option on other volumes.

As Spotlight indexes are maintained and stored on each volume, for the contents of that volume, you’ll need to repeat this for each volume on which you want to be able to search RTF files by their contents.

Is Spotlight re-indexing?

There was a day when it was simple to tell whether you had been successful in forcing these indexes to be rebuilt: within a minute or so, the hard disk in question could be heard in frantic activity. I’ve never heard an SSD do anything yet.

There are two reliable ways to check that re-indexing is taking place. Open Activity Monitor, and in its CPU view check that processes with names starting with md are taking plenty of CPU. These should include mds_stores, mdworker (often multiple copies) and mds.

Alternatively, check the Spotlight entries in the log using my free Mints. Time that log extract to cover the start of re-indexing and you should find entries stating something like:
21-05-12 13:13:00.673 Server IndexCreate diskStore:0x1608be4d3 device:16777235 rc:-1
21-05-12 13:13:00.674 Index Creating New Index

which are a giveaway.

If Spotlight doesn’t start re-indexing after a few minutes, add the volume back to the Spotlight Privacy list, restart, then remove it again, and see if that helps.