Sub topic 8
Exact phrases and AND, OR, NOT
This chapter assumes you can open Spotlight with the keyboard and run a basic file search. It also assumes you have seen the kind filters from the previous chapter. Here you will make queries more precise by combining words with exact phrases and three Boolean operators.
How Spotlight reads several words
When you type more than one word, Spotlight looks for items that match all of them. The words can appear anywhere in the file name, the content, or the metadata, and they do not need to be next to each other. So budget report finds a file that contains "report" on page 5 and "budget" on page 1.
That default is a good start, but it often returns too much. Phrases and operators give you control.
Exact phrases with quotation marks
Put words in straight double quotes to match them together, in that order. "quarterly report" finds files where those two words appear side by side. It skips files that only mention "quarterly" in one place and "report" in another.
Use a phrase when you remember a specific sentence fragment, a person's full name, or a product name.
AND, OR, and NOT
Spotlight understands three operators. You must type them in capital letters. In lowercase, or and not are treated as ordinary search words.
| Operator | Meaning | Example |
|---|---|---|
| AND | Both terms must match. This is the default, so you rarely type it. | `invoice AND 2026` |
| OR | Either term may match. | `invoice OR receipt` |
| NOT | Excludes items that match the term after it. | `budget NOT draft` |
These queries show phrases, exclusion, alternatives, and a kind filter together:
"quarterly report"
budget NOT draft
invoice OR receipt
kind:pdf taxThe last line combines a kind filter with a word. It returns only PDF files that match "tax".
Combining the pieces
You can mix phrases, operators, and filters in one query. Each addition removes or adds results in a predictable way:
- Start with the most specific word you remember, such as
invoice. - Add
OR receiptif you are unsure of the document type. - Add
NOT draftto hide early versions. - Add
kind:pdfto keep only one file type.
You can also limit a term to file names with the name: keyword. For example, name:invoice ignores files that only mention "invoice" in their text.
Common mistakes
- Lowercase operators.
budget not draftstill searches for the word "not". WriteNOT. - Curly quotes. Pasting text from a document can bring in curly quotes, and these may not work as phrase markers. Retype them as plain
"characters. - Over-excluding.
NOTremoves every item that matches the term, including files where the word appears once in a long document. If a file you expect is missing, remove theNOTpart and check. - Expecting a typo to match. A phrase is matched as written. If a phrase finds nothing, try the words without quotes.
Practice
Exercise
You want PDF files that mention "tax" or "VAT" but are not drafts. Write one Spotlight query for this, and explain why the operators must be capitalized.
Show answer
One query is kind:pdf tax OR VAT NOT draft. The operators must be capitals because Spotlight treats lowercase or and not as ordinary search words and looks for them in your files instead of applying them as operators. Because OR and the implicit AND can combine in unexpected ways, check that the results look right and adjust the query if needed.
Exercise
A search for "annual budget" returns nothing, but you know a file has the words "budget" and "annual" in it. What is the likely reason, and what do you try next?
Show answer
The quotes require the two words to appear next to each other in that exact order, and in the file they are probably separated or reversed. Try annual budget without quotes, which matches both words anywhere in the item.