In the spotlight
recently I noticed that spotlight on my MacBook kept responding with very long delays. A friend recommended to only index what you really need. For me the most important feature of spotlight is to start applications, so I decided to change the settings. But how do I trigger a re-index? A little googling and I found several tips which recommend to change the index configuration in the preferences pane and then after a few minutes change it back. The idea being "trick spotlight into indexing". Even though this approach probably works it just felt wrong and I decided to dig deeper. Here is what I found:
sudo mdutil -E /
This command will immediately force spotlight into a re-indexing your main disc.
Once on the right track I found out that there is a whole range of spotlight related tools - mdfind, mdimport, mdls and mdutil. Now that's more like it. If you want to know more about these tools check out this Spotlight tips article.