There is a lot of information out there about indexing PDF files in SharePoint, but not much on indexing other files that are really just text files, but don’t have an IFilter associated with them by default.
I found one great blog post at Adventures in SPWonderland that goes through the entire process of adding your source code indexed by SharePoint, but so I have it handy, I’m rehashing the part I really care about which is just getting the file extension recognized in SharePoint and assigning the text parser IFilter tquery.dll assigned to the new extension for full-text queries.
Adding the extension to the File Types
- Open your Shared Services Administration and under the Search section, click on Search Settings
- Click on File Types
- Click New File Type
- Type the extension you are adding, if you are adding *.cs files, you would type cs
(Note: Do not include the period in front of the name extension) - Click OK
Assigning the text IFilter to your extension
This next step is done to tell the SharePoint Server service which IFilter to use when it is indexing your new file type.
- Open the registry editor (Start –> Run –> Regedit.msc)
- Navigate to the key below:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice Server12.0SearchSetupContentIndexCommonFiltersExtension - Add a new key with the name of your extension, continuing with the .cs we used above, we will add a new key called .cs
- Change the default value to be {4A3DD7AB-0A6B-43B0-8A90-0D8B0CC36AAB}.
Finishing up
- Start and stop your Office SharePoint Server Search service, either through your services snap-in or by running the two commands below
net stop osearch
net start osearch - Now to update your index by performing a full crawl on any content sources that contain the types of files you just added this new capability to.