9 Replies Latest reply: Nov 8, 2011 9:28 AM by baltwo
beckmart Level 1 Level 1 (25 points)

I'm having problems with the search in Finder windows in MacOS X 10.6.8.

If I'm typing a search keyword in the textbox in a finder window and search for "file name" or "content", I get no or only a few results, although there should be much more results.

Is this a bug in OS X?

e.g. if I activate the search for "file name" and type "a" in the text box, I get 8 results. When I search for "b" instead, I get 61 results, and 60 of them have an "a" in the file name!

Is this a known bug?
Is there a solution?


I've already tried to

  • rebuild the spotlight index with sudo mdutil -E PathOfPartition several times
  • repaired permissions on the startup drive

... but no change - Finder/Spotlight does not list files as results, although they exist and match the search criteria.


MacBook, Mac OS X (10.6.8), 13" 2.16 GHz white '07, 3GB, 500GB
  • 1. Re: Spotlight/Finder search does not find files
    baltwo Level 9 Level 9 (60,085 points)

    Partial letter or phrase searches are problematic. Start with http://www.pinkmutant.com/articles/Leopard/leospot.html and http://www.thexlab.com/faqs/stopspotlightindex.html then my mod to Finder's Find at http://www.macosxhints.com/article.php?story=20080229204517495 for what you can change so you can find stuff excluded by the default structure. See http://lonestar.utsa.edu/llee/applescript/customfindSN.html for a Snow Leopard fix.

     

    Finally, DL and peruse the Spotlight Query manual.

  • 2. Re: Spotlight/Finder search does not find files
    beckmart Level 1 Level 1 (25 points)

    @baltow: Thank you for your answer!

     

    I'm not sure if you might have misunderstood my question (or I might have asked it badly):

     

    It's not about searching for system files (which seem to be excluded per default), but its about:

     

    If I'm searching for files by name in a directory, spotlight will find some of them, but not all matching files!

    This is not only for a one-letter search string but also for longer words, e.g.

     

    I'm searching in a directory (with subdirectories) for file name "Anschreiben".

    In Finder: 0 results

    Easyfind: 44 results!

     

    searching for pdf files with "Anschreiben" in their name:

    EasyFind can find 14 in the above mentioned directory (the other 30 are not pdfs)

    Spotlight will only find 8 in a system wide search!!

     

    So somethings wrong with spotlight or its index,

    but I did not see how the links you sent me should help. :-(

    Can you give me a hint?

    BTW the applescript with the SL fix is not available. :-(

  • 3. Re: Spotlight/Finder search does not find files
    baltwo Level 9 Level 9 (60,085 points)

    beckmart wrote:

    So somethings wrong with spotlight or its index,

    That's what the last linked document should address

     

    BTW the applescript with the SL fix is not available. :-(

    Sorry, borked URL. Try https://sites.google.com/site/llee040/applescript/customfindsn

  • 4. Re: Spotlight/Finder search does not find files
    beckmart Level 1 Level 1 (25 points)

    @baltwo

     

    thank you, I think, I'm getting nearer to the solution of the problem, but I still need help. :-|

     

    My system setup consists of 2 partitions:

    1) System partition containing MacOS X and user directories.

    2) data partition which contains most of my data (but some are in the user directory).

     

    That is not idealand it also seems to be the core of the problem.

    The data partition does not have the checkbox "ignore owner on this volume" checked.

    From my user account (with no admin rights) I can access (read + write) all the files that I'd like to search and find, so for my understanding, spotlight should be able to find them.

    But it does not.

     

    The example directory I wrote about in my questions is on the data partition.

    I copied it to my home folder (on the system partition), et voilà:

    Finder search gets the same number of results (44 in all and 14 pdfs) like EasyFind.

     

    So far, so good.

    How can I find out, what to do to fix that now for the whole data partition?

    (Unfortunately, I can not just copy all the files, as the paths are still needed as they are and there also would not be enough space on the system partition.)

     

    Can spotlight only find files for me which I own?

     

    How can I find out who's the owner of a file?

    (In the Finder info window, I can only see who has read/write permissions.)

     

    I admit that I do not have fully understood the concept of the file permissions in OS X (resp. UNIX). What would be a good read to learn that quickly?

  • 5. Re: Spotlight/Finder search does not find files
    baltwo Level 9 Level 9 (60,085 points)

    Launch the Terminal app in /Utilities, copy & paste this command into the window that pops up, hit the return key, at the Password: prompt carefully enter your admin user password (nothing shows up on the screen), and hit the return key again.

     

    sudo mdutil -E /Volumes/*

     

    This should erase all indexes and cause Spotlight to reindex all mounted volumes.

     

    As for owners & groups, this should explain things:

     

    own.png

  • 6. Re: Spotlight/Finder search does not find files
    beckmart Level 1 Level 1 (25 points)

    @baltwo:

    so the first user in the info panel is the owner?

    In the case of my problematic subdirectory (and my whole data partition!!!), this is:

     

    1) user3 - write only (a new account which I created for an apple store which repaired my macbook and where I tried quickly to refuse them to read my data -maybe with messing up my permissions?!.)

    2) myaccount (me) - read & write

    3) System - read & write

    4) admin - read & write

    5) everyone - no rights

     

    So it seems that the account "user 3" is the owner of my files and has only write access?

    And this is the reason why in my account (despite of read & write access to directory and files?!) I can not find things with spotlight?!

     

    So, firstly I will remove the account "user 3" which is not needed any more.

    Do I have to repair permissions afterwards for the volumes?

    And then finally, I'll try to rebuild the spotlight index?

  • 7. Re: Spotlight/Finder search does not find files
    baltwo Level 9 Level 9 (60,085 points)

    Yes, that's about right. For your data volume, run launch the Terminal app, copy & paste this command into the window that pops up, hit the return key, at the Password: prompt, carefully type in your admin password (since nothing shows up on the screen), hit the return key, and when the normal prompt returns, quit the Terminal app:

     

    sudo chown -R "your account name":admin /Volumes/"name of data volume"

     

    Substitute items in parentheses with the real names. Launch System Preferences->Accounts->delete the user3 account, restart, and all should be well>

  • 8. Re: Spotlight/Finder search does not find files
    beckmart Level 1 Level 1 (25 points)

    @baltwo: thank you very much!

    You finally helped me solving my problem.

     

     

    However, there are still 2 things I do not understand:

     

    a) can spotlight find only find files which are owned by the current user?

    (So although I have read & write permissions for some files (which I do not own) I can not search/find them??  )

     

    b) why does the one letter search string for filenames not list everything?

    Spotlight provies no warning about that and I'd consider that a but and not a feature.

    Is this documented somewhere?

  • 9. Re: Spotlight/Finder search does not find files
    baltwo Level 9 Level 9 (60,085 points)

    AFAIK, Spotlight can find everything, but doesn't report on things you don't own; thereby, protecting other users from snoopers. As to documentation, see the previous linked items or peruse the hits from this google search: spotlight site:macworld.com