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

Spotlight doesn't find html files

I'm a web developer. I have thousands of ".html" files, such as "india.html"


Spotlight won't find them.


It does find "india.cfm" files so I'll assume the problem is the html extension.


If I Show All in Finder it does them ... in a Find window section called "Developer" ... which doesn't appear in Spotlight, or is a choice in Spotlight Preferences.


This used to work. I'm now using 10.9.5. I don't know at which update it stopped working ... I don't perform this often but when I do it's critical.


I've repaired permissions and reindexed the drive (twice, by adding and removing the drive from Spotlight index preferences).


Thanks.

PowerMac, Mac OS X (10.4.11), Mac Mail

Posted on Oct 23, 2014 10:16 AM

Reply
7 replies

Oct 24, 2014 8:34 AM in response to Randy Zeitman

A test...


Made a plain text file, saved to desktop, apple.html. Spotlight doesn't find it. Duplicated it. Change the name to apple.txt. Spotlight immediately finds it.


Spotlight is having a problem with html.


Checked the Spotlight RichText.mdimporter and it has:


<array>
<dict>
<key>CFBundleTypeRole</key>
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
<string>public.rtf</string>
<string>public.html</string>
<string>public.xml</string>
<string>public.plain-text</string>
<string>com.apple.traditional-mac-plain-text</string>
<string>com.apple.rtfd</string>
<string>com.apple.webarchive</string>
<string>org.oasis-open.opendocument.text</string>
<string>org.openxmlformats.wordprocessingml.document</string>
</array>
</dict>
</array>

... so that's in there...

Jul 27, 2015 11:27 PM in response to Randy Zeitman

I had a similar issue and discovered that I had HTML coding error in the [head] section. I left off the "/" in the closing such that the head section was implicitly closed but not explicitly closed with a [/head]. I'm using square brackets in this reply to prevent issues.


In any case, if manually coding your HTML files be sure that is not a coding issue with start-tag and end-tag particularly in the HEAD part of the HTML file. Spotlight may be sensitive to HTML code that is not standard.

Jul 28, 2015 5:17 AM in response to Bill Bryson

Thank you but I don't understand this... it's like saying Spotlight won't index text documents with misspellings. (How else would I find misspellings?)


Spotlight needs to index what's there... not behave as an html validator.


What's troublesome about this whole thing is that I phoned Apple about this and they escalated it to the top... I spent a few hours with a very smart, helpful, and diligent support specialist ... and then nothing ... no follow ups, no return calls (he gave me his direct office number).


So ... what happened Apple? (Maybe the guy left Apple but no one picked up the case.)

Jul 28, 2015 7:23 AM in response to Randy Zeitman

My issue may not be yours but my point was to let you and others know that if the HTML code itself is not matched (I think particularly in the [head] ... [/head] section) that Spotlight will not index the terms in the "body" of the HTML because it thinks the entire files is one large [head] section.


I manually created these HTML files with TextWrangler and typically copy and past HTML code as a template. I did not have a [/head] in the head section (in error I left off the preceding /) so although Safari and other web browsers displayed the files correctly, Spotlight "saw" no body because there was no [/head] to explicitly end the header section so it skipped over the entire file. It was interpreting the HTML file with a strict interpretation - where there is a [head] - the header continues - until there is a [/head]. Note: Once again I have replace square brackets for the angle brackets that are actually used in the code.


In short, Spotlight does interpret the HTML code in a strict manner I believe so as to only index terms that the end user might actually see (e.g. those in the body).


This will be moot point if you look at your HTML files can confirm that [head] is closed properly with [/head].


This frustrated me for a while until I saw the missing "/" in my closing.

Spotlight doesn't find html files

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