Fix Spotlight Searching And Indexing Issue

PCMacFix Spotlight Searching And Indexing Issue

Spotlight – Apple’s system-wide search engine – was introduced way back in 2005 when OS X 10.4 Tiger was released.

Spotlight is a system-wide desktop search feature of Apple’s OS X and iOS operating systems. Spotlight is a selection-based search system, which creates a virtual index of all items and files on the system.

It provides fast desktop searching by extracting metadata in the background and storing the indexed metadata for future searches. When a query is made, the indexed metadata is searched for matching files.
Spotlight is a very useful resource in finding documents because it has the ability to search for text within a document as well as text in the title. This process, however, must require a large amount of processing power and time.
You can access Spotlight from its menu bar icon or in any Finder window.It looks like a magnifying glass on the upper right hand side of the menu bar or you can press Command + Space Bar to show or hide the Spotlight Search field.
Spotlight starts finding files when you begin typing in the Spotlight search field. It will display applications, files, and folders whose names match your search criteria, as well as files that contain your criteria within them, such as in text documents, applications, emails, calendars, and more. For example, if you type “itunes”, Spotlight will locate the iTunes application, as well as folders, System Preferences, and web searches that contain the text “itunes” or media files in them.
Spotlight Indexing
Pic-31(a)
Spotlight does not find everything on its own it will only find the ones you have permission to view and access.Spotlight also ignores files in the trash, the ones inside zipped archives and disk image (.dmg) files. Time Machine backups are ignored, as are certain System files.

Sometimes Spotlight doesn’t behave properly, or perhaps doesn’t know about files or folders that have just been created. Sometimes, it just forgets about files on external drives.And this is very annoying situation.For example, I saved a file with the name delegate in my documents and when I search it in the Spotlight it just doesn’t find it and returns the result as shown in the Pic- 31(b).

Pic-31(b)

So when it does not work, you will need to rebuild the entire Spotlight index on your Mac.Here’s how to start the re-indexing process of an entire drive.

How to start the reindexing process of an entire drive

Method 1
  • Launch System Preferences from the Apple menu.
  • Click on “Spotlight” and then click on the “Privacy” tab.
  • Drag Macintosh HD (and other drives if necessary) into this window.
Pic-31(c)
  • After it is dragged to this privacy box a confirmation dialog box appears.
Pic-31(d)
  • Click “OK” when asked to confirm and wait for a minute.
  • Now select the drive(s) you just added and click the “-” minus button to remove it from the list.and your Mac will create a new Spotlight Index.

This also works for external drives that aren’t indexing properly. Just drag them into the window, then remove them. To check on the progress just click the spotlight icon (magnifying glass) in the menu bar.

If this doesn’t initiate reindexing of the drive, you may need to initiate it manually through the command line.

Method 2

Open Terminal from Applications/Utilities folder and use the following command string to rebuild the Spotlight index for your Mac.

sudo mdutil -E /

After pressing enter, you’ll be required to enter your password (because this command runs as a super user). After you do that, you will notice after a few minutes that when clicking the Spotlight button in the menu bar, Spotlight will show that it is currently indexing your system.

Pic-31(e)

Next type the following command and hit return and type the password when asked.

sudo mdutil -i on /

Spotlight will begin building the index within a few minutes of issuing this command.Also note, that usually re-indexing Spotlight can take a while. it may take 30 minutes to an hour or two.

This terminal method can also be used to re-index specific external drives on your Mac. To do this all you need to do is modify the ending of the above code. I’ll give an example. I have an external drive called MyExtDrive. To re-index it in Spotlight I’d type in:

sudo mdutil -E /Volumes/MyExtDrive/

If you have an external drive you want to re-index, just replace the “MyExtDrive” part with the name of your drive.

Method 3 – Final Method when nothing works

When nothing works and you have tried everything you need to use the following guaranteed way to re-enable Spotlight indexing.
1. Open up the Terminal (found in /Applications/Utilities/) and enter the following commands based on the need to either disable or reenable Spotlight indexing.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
 
After the above mentioned command has executed the indexing is disabled.You’ll immediately notice that Spotlight is suddenly impotent, and returns only the generic “Search the Web” and “Search Wikipedia” options for each inquiry.
2. Now type the following command to Re Enable the spotlight indexing.
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
 
3. After running this command, restart the computer and you are done with the troubleshooting as your spotlight will start working normally.

Tips:

1. To prevent a specific folder or file from being indexed by Spotlight, add a “.noindex” extension to it.
2. You can use Spotlight like a calculator–simply type a mathematical expression in the search field.

 

Nasir Sohail
Nasir Sohail
Nasir is a software engineer with an M.Sc. degree in software engineering and various certifications related to computer hardware and networking, such as MCSE, CCNA, RHCE. He has more than 15 years of mixed industry experience mostly related to IT Support, Web development and Server administration. He also offers his freelancing gig for IT support and consultancy and has more than 300 five-star reviews across platforms like Fiverr, Google, TrustPilot, etc.
Watch & Subscribe Our YouTube Channel
YouTube Subscribe Button

Latest From Hawkdive

You May like these Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.