as an Alfred user, I recently found that using the Find + keyword or space spacebar + keyword can only retrieve part of the file. The same problem is often found in Spotlight file retrieval of OS X systems, and this is no exception.
How did this happen? How do I troubleshoot file indexing problems?
Method
Considering that Alfred's file retrieval utilizes the same OS X data Index (metadata index) as spotligt, we need to rebuild the index of the folder or file in order to get it back to normal.
According to the Spotlight of the Apple support page: How to reconstruct the index entry description for a folder or file, as follows:
From the Apple menu, select System Preferences.
Click "spotlight".
Click the Privacy tab.
Drag a folder or entire volume (hard drive) to the list.
If the system prompts for confirmation, click OK.
Click the item or volume that you just added to the list, and then click the Minus "-" button to remove it.
Turn off Spotlight preferences.
The system then rebuilds the index as shown in the "Final effect" screenshot page. After the index completes, Alfred and Spotlight's file retrieval work will return to normal.
Bonus: Let some documents not be searched by Spotlight
Spotlight's file search is great, but in order to prevent others from using your personal computer to retrieve private files, you can do so in the following two ways:
In the "spotlight" panel of System Preferences, you can uncheck some of the "search results" types, such as "pdf documents, bookmarks, and history, or you can add a folder or disk in privacy that prevents Spotlight from searching these locations.
But the disadvantage of this approach is that other people can delete folders that are not retrieved directly from the panel. At this point, you can achieve the same effect by adding a suffix ".noindex" to the folder (note: You can still view the contents of the folder normally after adding the prefix). This way, the contents of the ".noindex" folder cannot be learned unless someone manually looks at the folders in the Finder.