MacOS – Search results in Notes on macOS always empty

icloudmacosnotes.appsearch

No matter the search term, the search results in the Notes app on macOS are always empty:

enter image description here

This has been going on for a while. On iOS, the same searches work fine.

I have tried turning off iCloud, restarting, and then turning it on again. Didn't help.

Any ideas how to debug and solve this?

I'm on El Capitan.

Best Answer

@MacManager pointed me in the right direction. The problem was that I had excluded ~/Library/Containers from Spotlight. This is where Notes' data is stored.

I did this years ago way before the "modern" Notes existed and had totally forgotten about it. I wanted to stop Alfred from giving me results from that folder.

Apparently, the Notes app uses the Spotlight index for searching inside the app.

Ouch.