Q I have several folders containing very many SQL database files, which share the extension .sql, but are in different locations on my Mac. How can I stop Spotlight from searching them, as they seem to contain every keyword going?
A Spotlight offers four different ways to limit searches.
If your SQL files are in their own folders, and there are no other files in those folders which you do wish to include in Spotlight searches, then you can simply add those folders to the list in its Privacy tab (in the Spotlight pane). Spotlight will then stop indexing them, and they will be omitted from all future searches.
You can achieve the same effect by appending the extension .no_index to the folder containing the files, by putting an empty file there named .metadata_never_index, or simply by making the enclosing folder invisible to Finder (e.g. by prefixing a dot ‘.’ to its name).
Certain file types, such as PDF documents, can be excluded from searches even though they will still be indexed, by disabling (unchecking) them in the list in the Search Results tab. Unfortunately there does not appear to be a way of adding document types to that list, which would have been a perfect solution for you.
Finally, you can always exclude a given file type from any particular seach by appending NOT .sql to the end of the search string, although that would be tedious to have to do every time, and the files are still indexed.
