How to fix Mail.app not finding messages but spotlight finding the messages in High Sierra

The symptom was that mail.app search always returned 0 results when searching, but spotlight did find results.

What I needed to do to get it working again was to set:

sudo defaults write /Library/Preferences/com.apple.security.appsandbox UnrestrictSpotlightContainerScope -bool false

then reboot

and then run

sudo defaults write /Library/Preferences/com.apple.security.appsandbox UnrestrictSpotlightContainerScope -bool true

reboot again and voilà, I had working search again.

Update:

Turns out killing mds in activity monitor does the job fine as well. 🤦🏻‍♂️