Force Splotlight to search a subfolder Background:

I moved the Microsoft User Data from ~/Documents to ~/Library/Preferences because I didn't want Google Drive to sync my Office files. I can run Office products fine, but I can't search my mail because Spotlight can't search my .olk14Message files (under ~/Library/Preferences/Microsoft User Data/Office 2011 Identities/hobbes3/Data Records/Messages/).

Here is the weird part:

If I'm in ~/Library/Preferences then I can use Spotlight to search for all my mail .olk14Message, but if I'm one folder up in ~/Library or higher then I can't search for my mail... And of course I can't search for my mail from Spotlight globally (which breaks my Outlook 2011 searching).

Mail searches show up in ~/Library/Preferences

But not in ~/Library???


I've tried the following and it didn't work:


Symlinking Microsoft User Data from ~/Documents to ~/Library/Preferences
Re-indexing my entire drive with sudo mdutil -E /
Adding and removing the Microsoft User Data to the Privacy tab in Spotlight in System Preferences


Interesting results:

hobbes3@hobbes3-splunk ~ % mdimport ~/Library
2014-12-22 14:56:32.121 mdimport[2106:22241] Error loading /Library/Spotlight/Microsoft Office.mdimporter/Contents/MacOS/Microsoft Office:  dlopen(/Library/Spotlight/Microsoft Office.mdimporter/Contents/MacOS/Microsoft Office, 262): no suitable image found.  Did find:
    /Library/Spotlight/Microsoft Office.mdimporter/Contents/MacOS/Microsoft Office: mach-o, but wrong architecture
2014-12-22 14:56:32.121 mdimport[2106:22241] Cannot find function pointer OfficeImporterPluginFactory for factory BFA4E323-1889-11D9-82C8-000A959816BE in CFBundle/CFPlugIn 0x7fec4b063900 &lt;/Library/Spotlight/Microsoft Office.mdimporter&gt; (bundle, not loaded)
(Import.Error:711) Could not create instance for plugIn 'file:///Library/Spotlight/Microsoft%20Office.mdimporter/'
(Import.Error:867) BAD IMPORTER ~~~~~~~~~~~~~~~~~~ file:///Library/Spotlight/Microsoft%20Office.mdimporter/

hobbes3@hobbes3-splunk ~ % sudo mdutil -E ~/Library
/Users/hobbes3/Library:
    Error: unknown indexing state.
Spotlight considers anything in Library (all of them: /System/Library, /Library, and ~/Library) to be a "System file". (Exception: Yosemite considers /System/Library/CoreServices to be an applications folder and not a system files folder.) By default, it won't find such files unless you start inside the Library folder or add "System files" "are included" to the search terms. (If you don't see "System files" as an option, select "Other". Scroll through the list to find "System files", or instead of scrolling start typing "System files" in the search field. Optionally, turn on the check mark to add "System files" to the menu so you won't have to look for it again.)

Anything whose name starts with a period (like .olk14Message in your case) is considered invisible. Spotlight won't find anything that's invisible or in an invisible folder unless you either start in the invisible folder or add a search term for "File visibility" that says to report invisible items.

mdimport won't help here. Spotlight has already indexed even System files and Invisible files. It just won't show them to you unless you specifically ask for them.

For mdutil -E ..., you need to specify a volume, not a folder. Thus, for example, mdutil -E / would erase (and probably rebuild) the Spotlight index for your entire boot volume. You can't select anything smaller than a volume.