Spotlight Search on Yosemite indexes and shows iTunesLibrary.h and other files with ".h" extension I am running Yosemite on My MacBook Air.

Spotlight settings are as below:



Even though I have not selected any option, it still shows ".h" files in result. Check below image for reference.



As seen in above image, there is iTunesLibrary.h file in search results.

How to stop Spotlight from indexing those ".h" files? and how to remove those ".h" files from search results?
Did you have Xcode installed at some point? Generally those files (which are related to software development) are only indexed if Xcode is installed and the corresponding "Developer" item in Spotlight preferences is enabled.

In any event, since Developer does not appear in your Spotlight preferences, you can try doing it the manual way, based on steps found here:


Open Terminal (Applications/Utilities folder)
Enter the following command and press Return. You will be prompted for an administrator password. Enter the password and press Return.

sudo plutil -convert xml1 ~/Library/Preferences/com.apple.Spotlight.plist -o ~/Desktop/com.apple.Spotlight.plist

Open TextEdit.
Press Command-, to open the Preferences window.
At the top, under "Format", select "Plain text".
Drag com.apple.Spotlight.plist from your desktop onto the TextEdit icon on your Dock.
Press Command-F to search and type in SOURCE (in all uppercase like that). Press Return to search.
If it finds something that looks like this:

        &lt;dict&gt;
            &lt;key&gt;enabled&lt;/key&gt;
            &lt;true/&gt;
            &lt;key&gt;name&lt;/key&gt;
            &lt;string&gt;SOURCE&lt;/string&gt;
        &lt;/dict&gt;


Then change &lt;true/&gt; to &lt;false/&gt;. Save and close the document, quit TextEdit and skip to step 12.
If it did not find anything like that, copy that whole block (from &lt;dict&gt; to &lt;/dict&gt;).
Search the document again for &lt;key&gt;orderedItems&lt;/key&gt;. On the next line after that, it should say &lt;array&gt;. Scroll down until you find &lt;/array&gt;.
Click to place your cursor at the beginning of that line and paste. If it now looks like &lt;/dict&gt;   &lt;/array&gt;, click to place your cursor right after &lt;/dict&gt; and press Return to put &lt;/array&gt; on its own line. Save and close the document and quit TextEdit.
Back in Terminal, enter the following command and press Return. You may be prompted for an administrator password. If so, enter the password and press Return.

sudo plutil -convert binary1 ~/Desktop/com.apple.Spotlight.plist -o ~/Library/Preferences/com.apple.Spotlight.plist

Press and hold Option-Command and right-click on the Finder icon on your Dock. Select Relaunch from the menu.