MacOS – Sierra Spotlight vs mdfind vs finder

macosspotlight

I have seen several Sierra/Spotlight questions posted but none are what I am experiencing.

I am not receiving any errors when re-indexing. My migration to Sierra from El Capitan went without a glitch. However Spotlight does not return accurate results. Files I know exist do not show up.

My first and second thought was there is a corrupt mdstore, Rebuilt mdstore multiple times to no avail.

Observation 1 – mdfind in terminal works as expected. Finding all the files expected. However Spotlight does not.

Observation 2 – In Finder when using the first available search box the results are wrong and identical to spotlight results

Observation 3 – In Finder when using secondary search boxes (click + sign to open up additional search boxes) and clearing the first search box then all files are found as expected identical to mdfind.

So now I only use mdfind or finder with detailed search boxes and all is ok

Is this a bug in Spotlight and not an mdstore issue?

Sound like a bug to me

thanks

Best Answer

Regarding Observation 1:

As far as I understand, this is a long-standing bug in the way Spotlight is constructed (going back to Lion or even earlier). In Sierra it has just been acerbated to the point, where I have completely abandoned Spotlight and am using the Find (CMD+F) function in Finder. With this function I find all the files I am expecting to find and have also a larger array of options to choose.

According to my understanding the issue arises as Spotlight searches by strings and has some odd rules for defining strings, which appear to not be consistent at all.

Regarding Observation 2 and 3:

If a Spotlight search has been started the CMD-F function only returns the same as the Spotlight search. I can't figure out why it does do so. So you need to shut down the Spotlight search first to get a result with Find that is different from the Spotlight search result. It looks like the search results are not refreshed in between the two searches.

Further Observation to the issue of not refreshing search results: You search a file with Spotlight. Upon locating it you move it to a different folder. You use undo. From now on the file is found by Spotlight in the original folder even if it is moved again. But don't delete it - it is not a copy - it actually has been moved, Spotlight just refuses to acknowledge this.