Does anyone find that spotlight forgets docx files every day?

For setup, we've been dealing with spotlight issues for 4 years on two MacBooks with my wife's files. We've done all the usual tricks (for example spotlight privacy tab, sudo mdutil -E / ) and they work for a day or a few days but then the problem returns. I've searched a lot and compiled a ton of links on spotlight (and tricks).

Spotlight eventually forgets the docx files it indexed. One day a keyword yields 100s of docx results and the next day it yields a couple to none. The MacOS version is 10.13.6.

My current fix is to find all the docx files and force each one to be re-indexed.

find /Users/username -name '*.docx' -print0 | xargs -0 mdimport -d1

This command has it re-index them using the Rich Text importer. Again this works for the day and by the next day searches produce little to no results.

Has anyone encountered this problem? And found a solution?


Solution 1:

I was having a similar issue with Numbers files, with them being remembered by Spotlight for varying lengths of time and then being forgotten. Often I had to open files from the 'Open Recent' menu because Spotlight didn't return them. Usually that got them back into the spotlight index, but only temporarily. Perhaps it wasn't only Numbers files, just that those were the ones I'd been searching for.

In my case, it turns out that I had very little free disk space. Enough for what I thought of as my storage needs, but apparently not enough for the system to operate correctly.

I moved 30GB of files to an external drive, emptied the trash, rebooted, ran sudo mdutil -E /, waited for indexing to complete, rebooted again.

That was yesterday, and so far so good. Spotlight has returned everything that I've thought to search for. Also, my machine had been getting quite sluggish but now feels quite responsive. I hope this helps you, or others who find this thread.

[Update: things are better but not solved. There's still some mysterious gaps in my spotlight search results. Doesn't seem to matter whether it's files on the local disk, on iCloud drive, opened recently, etc.]