Order of Precedence

When a search uses more than one operator, for example AND and OR together, the order in which Docwize applies them decides which documents are found. This page explains that order, so that a search such as report OR summary AND final finds the documents you meant.
Docwize applies the operators in this order: what is inside brackets first, then NOT to the word or group straight after it, then AND, and last OR. So AND joins its two sides before OR is applied. Use brackets whenever a search mixes AND and OR, so that the search means exactly what you wrote.
For what each operator does on its own, see Search operators.
What this page helps you understand
- how Docwize reads a search that mixes AND, OR and NOT
- why brackets make a search do what you meant
- how to avoid common mistakes when combining operators
Brackets come first
Words inside brackets are combined first, and the rest of the search treats the result as one word. It makes no difference whether the bracketed part comes at the start or at the end of the search.
| Search | Finds |
|---|---|
(invoice OR receipt) AND approved | Documents with approved and either invoice or receipt. |
approved AND (invoice OR receipt) | The same documents. |
AND comes before OR
Without brackets, Docwize joins the words on either side of AND first, and then adds the documents that match on the other side of OR. A search such as invoice OR receipt AND approved therefore means invoice, or receipt and approved.
| Search | Finds |
|---|---|
invoice OR receipt AND approved | Documents with invoice, and documents with both receipt and approved. |
report OR summary AND final | Documents with report, and documents with both summary and final. |
NOT applies to the word after it
NOT (or !, or -) leaves out documents with the one word, or the bracketed group, that comes straight after it. It does not reach any further along the search.
| Search | Leaves out |
|---|---|
invoice AND NOT draft OR archived | Documents with draft, from the invoice documents. Documents with archived are not left out. |
invoice AND NOT (draft OR archived) | Documents with draft and documents with archived. |
invoice !draft !archived | Documents with draft and documents with archived. |
Common mistakes
These examples show how a search that mixes operators without brackets can find something other than what you meant, and how brackets fix it.
1. The Ambiguous OR
| Scenario | Search | What you meant | What Docwize finds | What goes wrong | The fix |
|---|---|---|---|---|---|
| You want to find all final documents that are either a report or a summary. | report OR summary AND final | (report OR summary) AND final | Documents with report, and documents with both summary and final. | Reports that are not final are found, and final applies only to summary. | (report OR summary) AND final |
2. The Ambiguous NOT
| Scenario | Search | What you meant | What Docwize finds | What goes wrong | The fix |
|---|---|---|---|---|---|
| You want to find all invoices but leave out any that are drafts or archived. | invoice AND NOT draft OR archived | invoice AND NOT (draft OR archived) | Documents with invoice that do not mention draft, and documents with archived. | NOT only applies to draft, so archived documents are found even when they are drafts. | invoice AND NOT (draft OR archived)or invoice !draft !archived |
3. The Unquoted Phrase
| Scenario | Search | What you meant | What Docwize finds | What goes wrong | The fix |
|---|---|---|---|---|---|
| You want documents containing the exact phrase project status report. | project status report | "project status report" | Documents with project, status and report anywhere in them. | The words do not have to be together, so the results include many documents that are not status reports. | "project status report" |
How to combine operators in one search
| Step | Description |
|---|---|
| 1 | Put each part of the search that belongs together in brackets, for example the words you would accept instead of each other: (invoice OR receipt). |
| 2 | Join the bracketed parts with AND, or put NOT in front of a part to leave it out: (invoice OR receipt) AND NOT (draft OR archived). |
| 3 | Put any words that must appear together in quotation marks: "project status report". |
| 4 | Press Enter, or click Search. |