Using Windows Search to Index your Source Code
I really like having Windows Search integrated into the Start Menu in Windows. It’s a handy way to find documents, programs and even control panel links. I found it really strange, however, that I couldn’t find classes and methods in my source code. After a little digging in the Indexing Options control panel applet uncovered the problem. For a particular file type, Windows Search gives you two options:
- Index File Properties – this includes the file name, type and any metadata on the file (e.g. the Title on a Word document).
- Index Properties and File Contents – this is a more appropriate choice for files whose content you would want to search for (like source files).
Unfortunately, for a lot of common source file types, Windows Search defaults to indexing the file properties only which means that you won’t find your classes and methods in your source files unless you follow these steps:
- Open the Indexing Options control panel applet
- Click the Advanced Button
- Select the File Types tab
- Change the following extensions to Index Properties and File Contents: asax, ashx, asmx, config, cs, dt, fs, log, php, sln, testsettings, vb
- Click OK and close the Indexing Options dialog
- If you keep your sources in some location other than your user profile directory, you’ll want to add those folders to the locations to be indexed
It will take a while to rebuild the Windows Search index but, when it’s done, you’ll be able to search your source files just like any other document.
When investigating the problem of searching source files, I also noticed that the contents of my Visio and PDF files were not getting indexed. Fortunately, this problem is easily solved by installing the Microsoft Filter Pack and the Adobe PDF IFilter.
- Anonymous
March 13, 2010
The comment has been removed