Sub topic 7
Narrowing results by kind
This chapter assumes you can open Spotlight and run a basic search for a file by name or content. It also assumes you know what a file type is, such as PDF, image, or folder. Here you will learn how to cut a long result list down to one kind of item.
Why filter by kind
A short word like "tax" can match hundreds of items. They include PDFs, emails, images, app names, and web suggestions. Spotlight stores a content type for each item in its index. You can use that type to keep only the items you want. This is often faster than scrolling through a mixed list.
Using the kind keyword
Type kind: followed by a category, then add your search words. Spotlight keeps only items of that kind.
kind:pdf tax
kind:folder projects
kind:image beach
kind:app calendarThe order can vary. tax kind:pdf and kind:pdf tax give the same kind of result. Common kinds include:
| Keyword | Matches |
|---|---|
| `kind:pdf` | PDF documents |
| `kind:image` | Photos and graphics |
| `kind:folder` | Folders |
| `kind:app` | Applications |
| `kind:music` | Audio files |
| `kind:movie` | Video files |
| `kind:email` | Mail messages |
| `kind:document` | Documents in general |
Using the name keyword
The name: keyword limits a match to file names. Without it, Spotlight also searches inside file contents. That can bury the file you want under documents that merely mention the word.
name:invoice
kind:pdf name:invoiceThe second query returns only PDFs whose names contain "invoice". Use it when you remember the file name but not where the file is stored.
Narrowing step by step
A good habit is to start with a kind and add words only as needed.
- Type
kind:pdfand look at the results to confirm the filter works. - Add a word you remember, such as
kind:pdf budget. - If there are still too many results, add
name:to restrict matches to file names. - If the right file is not in the list, remove the last word and try a different one.
Common errors
- A space after the colon. Write
kind:pdf, notkind: pdf. A space makes Spotlight treatkind:as an ordinary word. - Expecting kind alone to search content.
kind:pdfby itself lists PDFs. You still need a search word to find a particular one. - Filtering on something that is not indexed. If a folder is excluded in Spotlight settings, or indexing is incomplete, items of the right kind will not appear. Later chapters cover how to check this.
- Mixing up kind and file extension.
kind:pdfmatches by content type. A PDF with a missing or odd extension can still match, which is usually what you want.
Connection to Terminal searches
The kind: keyword is a friendly shortcut for a stored content type. The command-line tool mdfind uses the full attribute name, kMDItemContentType, for the same idea. A later chapter shows that form.
Exercise
You remember that a file called "lease" is a PDF, but searching "lease" shows many emails and notes. Write a query that shows only PDFs with "lease" in the file name.
Show answer
kind:pdf name:lease. The kind:pdf part keeps only PDF documents, and name:lease ignores matches inside file contents.
Exercise
Why does kind: image (with a space after the colon) fail to narrow results?
Show answer
The space breaks the keyword. Spotlight no longer reads kind: as a filter, so it searches for the words "kind:" and "image" instead. Write kind:image.