You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Old problem with Spotlight and Word .docx files

There is an old problem with Spotlight not finding Word .docx files. You can find old discussions about this from 2008. But despite this problem being ancient it has never been solved.


The essence of the issue is that Spotlight relies on a variety of software modules to index files. Spotlight chooses the appropriate module to index each different type of file. These indexing modules all have the file suffix .mdimporter. There name of the module for indexing Microsoft office files is "Microsoft Office.mdimporter" and it can be found with some other .mdimporter modules at /Library/Spotlight/. The"Microsoft Office.mdimporter" module has copyright info from Microsoft inside its package so we know who wrote it. But this module is included with all new Macs by Apple. Perhaps this is why this problem has never been fixed - the software is written by Microsoft but delivered by Apple.


The symptoms of the problem are that Spotlight will not find content in some .docx files. It is not clear why it fails on some .docx files but not on others. This problem does not seem to affect other Microsoft formats such as .doc, .xls, .xlsx, etc.


Given that Apple wants to sell Macs to business, and that businesses make heavy use of MS Office typically, one would think that this would have been a priority to fix. But given that this problem is 7 years old and still unsolved I guess not.


Any suggestions on work-arounds would be welcome.

OS X Mountain Lion, latest release of OS X

Posted on Dec 7, 2015 11:09 AM

Reply
39 replies

Feb 9, 2016 8:50 AM in response to Jonathan Brown

I think the reason neither Apple nor Microsoft has done anything about the failure of Spotlight to index docx documents is that it's not an obvious problem for many people who continue using doc files rather than docx, and it's not obvious even if you do use docx files unless you happen to be looking for something that you know is only in a docx file.


In any case, I've run into the problem using Mavericks, and I'm curious about fixes that don't requiring setting up special scripts.

Feb 9, 2016 1:44 PM in response to Jonathan Brown

Jonathan,


Thanks for your responses. You have gone much deeper with this than I. I have had success using the script that I posted on Dec 28, 2015. This is automated in crontab as I mentioned so I don't think about it anymore. And the problem has been gone for months now so I guess this is a solution that is proven to work (on 10.11 at least).


I don't intend to change versions of Office until I am absolutely forced to when support stops on Office 2011. So I guess I will just stick with what I have until that time then revisit this problem.

Feb 10, 2016 12:42 PM in response to bjfromvelp

bjfromvelp's process worked for me, and I'm on Mavericks and office 2011 on a 2010 MacMini.

I removed Microsoft Office.mdimporter from /Library/Spotlight (keeping a copy on the desktop just in case)

added my Documents folder to the privacy tab of spotlight (to avoid searching a large file of PDFs in other files)

Then removed my Documents folder from the privacy tab.

Spotlight pondered a bit, and now seems to index both .doc and .docx documents, as well as RTFs and texts.

So far, so good. Maybe something will disappear, but that seems to solve it. Thanks.

Feb 10, 2016 3:45 PM in response to fiberhome

Turned out today that all file names were found after the changes I made, but not all files could be searched on content. I had to change the permissions of my documents folder: "everyone" to read&write; now all files can be searched. Just can't explain why I had to do this. Also can't explain why only the doc/docx files couldn't be searched... But it seems to work completely now.

Mar 11, 2016 4:25 PM in response to bjfromvelp

I may have a simpler solution, or at least a band-aid that will get the system working the way it should. Copy RichText.mdimporter and paste it into the folder where Microsoft Office.mdimporter is located. Then reindex your entire hard drive. I did this, and afterward everything seems to be working the way it should, at least for now.


I think this is working because RichText.mdimporter is essentially bypassing Microsoft Office.mdimporter. When I tried using terminal to manually reindex a .docx file using Microsoft Office.mdimporter, I got an error message. When I tried using terminal to manually reindex the same file using RichText.mdimporter, it worked fine.

May 16, 2016 9:22 AM in response to Rumboogy22

Hi Rumboogy22,

I know this is an old post, but after endless researching and trying different "fixes", the script you posted in Dec. 2015 is the ONLY thing that works consistently well for me. However, I am still unable to figure out how to automate the script. I tried an app called "LaunchControl" but couldn't get it to work... You mentioned something about "crontab" - if you have the time, could you please post (or send me) detailed instructions on how to set it up? Thanks a lot!

May 18, 2016 11:32 AM in response to Rumboogy22

I was referring to different versions of a document - the original draft, and revisions 2 through 6.

Spotlight was finding the older ones, but not the newer ones - all in the same folder, all containing the searched-for term. Forcing Spotlight to index the .docx files worked, but relying on Spotlight to update the index on its own did not work. In any event, ditching the Office mdimporter did the trick.

Jun 5, 2016 2:11 AM in response to mistersharma

Did you carry out all of the following steps?

Remove Microsoft Office.mdimporter from /Library/Spotlight - stash it in a folder, in case you ever need it.

Make sure that Rich Text.mdimporter is present.

Open preferences, and add your entire HD to the privacy tab of spotlight preferences

Close preferences

Reboot (shouldn't really be necessary, but it can't hurt.)

Open preferences, and remove the HD from the privacy tab of spotlight preferences

Wait while Spotlight re-indexes your disk. This could take quite a while.

That should do it.

One of the posters above found it necessary to change the permissions of his documents folder to allow "everyone" to read & write. Not true in my case, but your Mac might have the same quirk. I'd be sure file sharing was turned off, if I had to leave the permissions in that state.

If it's still not working follow Rumboogy22's advice and run this test in Terminal:

Terminal command:

mdimport -d1 /Users/YourUserName/FolderName/DocName.docx

The bolded pathname should be for a .docx file somewhere in your user folder. You can just type "mdimport -d1 " (note the final space), and drag the file icon into the terminal window to create the pathname.


The output of the command should look much like this:

2015-12-29 00:59:38.755 mdimport[9479:543385] Imported '/Users/YourUserName/FolderName/DocName.docx' of type 'org.openxmlformats.wordprocessingml.document' with plugIn /System/Library/Spotlight/RichText.mdimporter.


This should verify that Spotlight is (a) recognizing the file as an xml word processing document, and (b) using Rich Tex.mdimporter to open .docx files.

If everything checks out, but Spotlight is still not indexing .docx files, you could try replacing Rich Text.mdimporter with a fresh copy from another Mac running the same OS. I can't think of anything else to try beyond that, other than re-installing the OS itself.

Jul 5, 2016 6:33 AM in response to fiberhome

Applying bjfromvelp's process helped for a while, but I now find that Spotlight is not indexing "doc" files. It seems to be indexing some docx files, but I suspect not all of them. I checked the Library/spotlight file and found the Microsoft Office.mdimporter file has not been replaced. Something else must be going on. Has anybody else seen this? I did update MS Office 2011 once or twice in since the last few months, and wonder if that did something, but I can't be sure.

Old problem with Spotlight and Word .docx files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.