A customer was having problems with server-side Spotlight searching in Finder giving inaccurate results - basically using a partial file name would give less results than using the whole name. When rebuilding the index didn't help I began to study this problem closely…
… which lead me to the discovery of yet another “undocumented (bad) feature” in Finder and more importantly, Spotlight. When you use the built-in search field, the search term is not “any name that contains this” or even “any name that starts with this”, but rather “any *word within a name* that contains this”.
The following illustrates this (I use mdfind to save bandwidth, but the results are the same from the Finder GUI):
$ mkdir sltest $ cd sltest $ touch summertime.txt $ alias mdfind="mdfind -count -onlyin $PWD" $ mdfind summer 1 $ mdfind time 0 $ mv summertime summerTime.txt $ mdfind time 1 $ mv summerTime.txt summer\ time.txt $ mdfind time 1 $ mv summer\ time.txt sumMertime.txt $ mdfind time 0
… you get the idea. The default search in Finder and mdfind uses a weird matching logic which differs from what most people would assume. The problem exists on both server and workstation versions of 10.5.6.
The good news is that there is a workaround - always use the Cmd-F Name > contains criteria for the broadest search, giving you this:
instead of this:
Spotlost indeed. :-)