Broken Finder

dlbmacfan

macrumors regular
Original poster
Jul 20, 2011
151
33
I've discovered a strange problem with Finder. It only returns partial search results, as you can see in the attached screenshot. I've spoken at length (5-10 total conversations over a period of weeks) with upper level Apple Support but they were unable to find a solution. The problem is not specific to one computer. When I sent a group of images to Apple Support, Finder on their computer missed the same files that were missed on my computer. I get matching erroneous search results on all of my Apple computers. The problem is not specific to a single text string or a specific folder. Any help here would be greatly appreciated!

 

dlbmacfan

macrumors regular
Original poster
Jul 20, 2011
151
33
If you want "better searching", try both of the following:
EasyFind:
http://www.devontechnologies.com/products/freeware.html

Find Any File:
http://apps.tempel.org/FindAnyFile/

Both all small, work very well, and... FREE
Thanks for the links. I'll definitely have a look. But I'm also interested in understanding why Spotlight Search fails at this basic task, and finding a solution from inside OS X.
[doublepost=1502638983][/doublepost]If any of you is interested in testing my problem on your own computer, try naming a JPEG "20170806-_Z2A9657-Pinyon-Jay-4x6.jpg" leaving out the quotation marks. See if spotlight search can locate it. Another curious behavior: if you delete "-4x6" from the title, spotlight search is able to locate the file.
[doublepost=1502639552][/doublepost]Find Any File works great! So why does Spotlight Search come up short?
[doublepost=1502639895][/doublepost]Here's what Find Any File locates:

 
Last edited:

dlbmacfan

macrumors regular
Original poster
Jul 20, 2011
151
33
Spotlight found the file instantly on my Mac. I'm running 10.12.6. (see below):

Try searching for the word Pinyon instead. I'm a bird photographer and I use Finder to locate all photos of a given species. But it only returns partial results.
 

ab298

macrumors member
Jun 18, 2017
62
12
Thanks for the links. I'll definitely have a look. But I'm also interested in understanding why Spotlight Search fails at this basic task, and finding a solution from inside OS X.
[doublepost=1502638983][/doublepost]If any of you is interested in testing my problem on your own computer, try naming a JPEG "20170806-_Z2A9657-Pinyon-Jay-4x6.jpg" leaving out the quotation marks. See if spotlight search can locate it.


I see the same problem that you do : it's been raised before at
https://apple.stackexchange.com/questions/175294/how-finder-can-find-this-file-with-long-name
 

MC6800

macrumors 6502
Jun 29, 2016
368
126
Interesting though that each of the four Pinyon Jay files has the exact same number of characters in the filename but only 2 of the 4 show up in the results.
I played around with this and there's something really weird going on with Spotlight's string interpretation there, related to the "-4x6" on the end of the name, of all things. Apparently any name ending in the form number-letter-number causes it to not match.

There is a workaround, but it's not pretty:

In Finder, do a Command-F to bring up a search window.
Click the "kind" pulldown and choose "Other...".
Type "Raw" in the search box there, and set the "In Menu" checkmark for Raw Query. Click OK.
Click the "kind" pulldown again and choose "Raw Query".
In the new Raw Query box, enter exactly:
Code:
kMDItemFSName = '*Pinyon*'
Click "Save" to make this a Smart Search if you like.

This can also be done from the command line:

Code:
mdfind "kMDItemFSName = '*Pinyon*'"
It would be nice if there were a way for mdfind to show its interpretation result. Anyone know how?
 

ab298

macrumors member
Jun 18, 2017
62
12
It seems to work here by choosing Name : contains in a smart folder.

Not perfect, but having that in the sidebar & clicking to type a different search term is perhaps easier than using another application.
Screen Shot 2017-08-13 at 15.50.48.png
 

MC6800

macrumors 6502
Jun 29, 2016
368
126
It seems to work here by choosing Name : contains in a smart folder.

Not perfect, but having that in the sidebar & clicking to type a different search term is perhaps easier than using another application. View attachment 712813
Good find-- I hadn't expected that to work because it still interprets, but see that it interprets differently, using the save-search feature and examining the XML file that saves in ~/Library/Saved\ Searches for the RawQuery field.

Bad case (original) is equivalent to:

mdfind '(kMDItemDisplayName = "pinyon*"cdw)'

Good case (yours):

mdfind '(kMDItemDisplayName = "*pinyon*"cd)'

I tried other combinations and it seems it's the "w" comparison modifier that causes the strange failure. The "c" and "d" are documented here, but not "w"?
[doublepost=1502657581][/doublepost]Found the updated documentation, and the "w" modifier causes a word-based comparison. Definitely has a bug in it.
 
  • Like
Reactions: ab298

dlbmacfan

macrumors regular
Original poster
Jul 20, 2011
151
33
It seems to work here by choosing Name : contains in a smart folder.

Not perfect, but having that in the sidebar & clicking to type a different search term is perhaps easier than using another application. View attachment 712813
That actually seems to work! Thank you very much for your input!

 
Last edited:

Ebenezum

macrumors 6502a
Mar 31, 2015
782
259
I noticed similar problem back when Yosemite was released and reported it to Apple. I also reported it for the all newer versions.

Unfortunately it hasn't been fixed but if enough people report it Apple might fix it. Although I have given up on Spotlight and I currently use EasyFind which works much better.
 

BLUEDOG314

macrumors 6502
Dec 12, 2015
351
87
I have experienced similar things before. You could try to force macOS to reindex your drive and see if that helps. Go into system preferences > spotlight > privacy, then add your entire Macintosh HD volume to the exceptions list. Close system preferences, then go back and remove it from the exceptions list and give it time to reindex.

If this fails you can always use the less elegant find in terminal.
 

dlbmacfan

macrumors regular
Original poster
Jul 20, 2011
151
33
I have experienced similar things before. You could try to force macOS to reindex your drive and see if that helps. Go into system preferences > spotlight > privacy, then add your entire Macintosh HD volume to the exceptions list. Close system preferences, then go back and remove it from the exceptions list and give it time to reindex.

If this fails you can always use the less elegant find in terminal.
Reindexing was the first thing I tried. It doesn't work. But several of the suggestions above do work, and they're not too clunky.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.