How to search for files by keyword in Spotlight on macOS
Spotlight is great for finding apps and files if you use the correct search term. That search term has to be the name of the file of course. If you have files that you want to be able to find and open from Spotlight using a single keyword e.g., a group of files all related to a particular project that you’re working on, you should make use of tags. This means you will have to put in a little work to get the files to show up but it is worth it in the end. Here’s how you can use tags to search for files by keyword in Spotlight.
Search for files by keyword
Open Finder and navigate to the file that you want to come up when you search for a particular word in Spotlight. Right-click it and select Tags from the context menu. This will let you add tags to the file.
Tags on macOS aren’t just color-based. They can be text-based as well and you will find that macOS has excellent file tagging support. In fact, it is exponentially better than what Windows 10 has. Once you’re in tag editing mode, enter the keyword you want the file to show up under, and tap Enter. That’s all you have to do. Repeat this for all files and folders that you want to associate with the tag/keyword.
When you next use the keyword in Spotlight, the file(s) that you added the tag to will be listed as one of the results. Overtime, Spotlight will learn which file you open more frequently and it will show up at the top of the search results.
If you want to remove the tag and the keyword association for the file, simply visit it again in Finder. Right-click it and select Tags from the context menu. The tags field will contain the tag(s) that you added before. Delete them, and the file(s) will no longer show up when you search for that particular word in Spotlight.
It obviously takes a bit of work and time to get files to show up for a certain keyword. You can make it easier if you move all the files to a single folder and add the tag to the folder instead of to individual files.
Much like you can get a file to show up for a certain keyword, you can also exclude certain files from showing up under Spotlight. All you have to do is blacklist it.