One of the much-touted features Apple introduced in 10.4 was Spotlight, its new lightning fast search. Spotlight pores over all the files on your computer, polls the metadata attached to each file, and makes a master index of everything that you have on your computer. Sounds great, right?
Well, not always. Sometimes, there may be items you don’t want searched for and I’m not just talking about porn. For example, do you really want your kids to find your bank records that you have stored on your computer? Or worse, find them and accidentally delete them?
Fortunately, it looks like there’s a way to fix that, beyond using the Privacy tab in the Spotlight preference pane. Anything you don’t want Spotlight to index, put it in a folder and add “.noindex” to the folder’s name. I like this method better than using Spotlight’s privacy because a) you can do it on the fly if needed and b) what’s the point in hiding something if you’ve got a master listing of what’s hidden sitting in the Spotlight preference pane?
Of course, you now still have your (now hidden) file listed in the existing Spotlight database. Want to get rid of it? Here’s how:
In the Spotlight system preferences, go to the Privacy tab and drag and drop the volume you want to re-index into the table. That will erase the index of that volume, as you’ve asked it to now be non-searchable. Just remove the volume from the table, and indexing will re-start and create a new database.
This can also be achieved in the Terminal by using the following command:
sudo mdutil -E /path/to/volume
For example, sudo mdutil -E / will erase the boot volume database. See man mdutil for more options.