Skip to content

Instantly share code, notes, and snippets.

@marekkowalczyk
Forked from florido/DevonThink Search operators
Last active November 28, 2020 00:13
Show Gist options
  • Save marekkowalczyk/5c756f9d2fcb3c63ed47e8a0b9a534d0 to your computer and use it in GitHub Desktop.
Save marekkowalczyk/5c756f9d2fcb3c63ed47e8a0b9a534d0 to your computer and use it in GitHub Desktop.
DevonThink Search operators (formatted as Pandoc Markdown)
---
header-includes: \usepackage{noto}\urlstyle{tt}\usepackage{titlesec}\titlelabel{\thetitle.\quad}
numbersections: true
papersize: a4
lang: en
documentclass: article
title: DevonThink Search Operators
---
In the toolbar search field, as well as in both the interactive and the simple
web interface, you can use standard and extended Boolean operators,
parenthesis, and more to fine tune your search.
The syntax of the operators is compatible to DEVONagent and EasyFind, the
Finder, Spotlight, common search engines as well as common programming
languages such as C, C++, Objective-C, Java, and JavaScript. The complexity of
the query is unlimited.
# Scope of search characters
DEVONthink searches are limited to alphanumeric characters only. Any
non-alphanumeric characters are ignored, except the non-alphanumeric characters
that are assigned as wildcards in DEVONthink, which are evaluated as such.
# Case
All terms are case-insensitive. You may, if you wish, use capitalization for
proper names in a query, but DEVONthink Pro Office will ignore case in
interpreting the query.
# Precedence of terms
Search terms and associated operators will be interpreted from left to right,
except as modified by including portions of the query within parentheses.
# Wildcards
You can replace parts of words with wildcards matching one, multiple, or a
range of characters:
`?`
: Matches exactly one character.
`*`
: Matches none, one, or multiple characters.
`[a-b]`
: Matches one character of the range `a` through `b`.
`[abc...]` or `[a|b|c|...]`
: Matches one character out of the given list of characters.
`[^...]`
: Matches one character that is not contained in the given list or range.
# Boolean operators
The operators (often called Boolean operators) are words or symbols that
establish logical rules for the terms in the search query. If no operator is
given, DEVONthink Pro Office infers AND. The available Boolean operators are:
`term1 term2`
: Contains `term1` and `term2`.
`term1 AND term2`
: Contains `term1` and `term2`.
`term1 BUT term2`
: Contains `term1` and `term2`.
`term1 OR term2`
: Contains `term1` or `term2`.
`term1 XOR term2`
: Contains `term1` or `term2`, but not both.
`term1 EOR term2`
: Contains `term1` or `term2`, but not both.
`NOT term`
: Does not contain `term`.
`"term1"`
: Contains the string of words `term1`, in exactly this form.
Besides the classic Boolean operators, DEVONthink Pro Office uses a number of
operators that usually are found in high-end databases. Use these operators as
a replacement for `AND` and `"`quotes`"` to fine tune your query.
`term1 OPT term2`
: `term1` needs to occur, `term2` can. If `term2` does, the found document ranks higher in the search results.
`term1 NEAR term2`
: `term1` occurs 10 words or less before or after `term2`.
`term1 NEAR/n term2`
: `term1` occurs `n` or less words before or after `term2`.
`term1 BEFORE term2`
: `term1` occurs before `term2`.
`term1 BEFORE/n term2`
: `term1` occurs `n` or less words before `term2`.
`term1 NEXT term2`
: `term1` occurs right before `term2` (shortcut for `BEFORE/1`).
`term1 NEXT/n term2`
: `term1` occurs `n` or less words before `term2` (synonym for `BEFORE/n`).
`term1 AFTER term2`
: `term1` occurs after `term2`.
`term1 AFTER/n term2`
: `term1` occurs `n` or less words after `term2`.
`~term1`
: Contains `term1`, also as part of a word.
For convenience, some of these operators can also be abbreviated using commonly
used symbols:
`AND`
: `&`, `&&`, `+`
`OR`
: `|`, `||`
`XOR`
: `^`, `^^`
`NOT`
: `!`, `-`
Note: The symbols above are also used by the Finder and Spotlight for searches.
Enter the vertical ruler character for the OR operator by pressing `Option-7`
(e.g. on European keyboards).
Operators are evaluated in the following priority:
> `parenthesis` > `phrase/hyphens` > `(NOT) BEFORE/AFTER/NEAR/NEXT` >
> `NOT` > `AND/OR/XOR/EOR`.
Terms with same priority but without parenthesis are evaluated from left to
right.
# Date comparison operators
For comparing dates in smart groups the following operators are available:
`< date`
: Matches items that were created/edited/viewed before `date`.
`<= date`
: Matches items that were created/edited/viewed before or on `date`.
`>= date`
: Matches items that were created/edited/viewed after or on `date`.
`> date`
: Matches items that were created/edited/viewed after `date`.
# White space handling
- Words linked by *non-white separators* (e.g. `www.devon-technologies.com` or
`page_id`) are treated like phrases put into `"`quotes`"`.
- Words separated by *hyphens* are handled like `word1word2 OR "word1 word2"`.
- Characters separated by *dots* are considered to be abbreviations and
therefore handled like words separated by hyphens, e.g., the term `t.a.t.u` is
equal to `"t a t u" OR tatu`.
# Examples
By using any or all of the operators and rules layed out above you can create
complex queries that find the exact information you're looking for. Here are
some example queries that show how the operators are used.
- `Devonian Dinosaurs` looks for all documents that contain the words
`devonian` and `dinosaurs`.
- `(Steve NEAR Jobs) AND iMac BUT NOT MacBook OPT Pro` looks for documents that
contain the words `Steve` and `Jobs` no farther ten words away from each
other, as well as the word `iMac` (no specific position relative to `Steve`
and `Jobs`), but not the word `MacBook`. The word `Pro` does not need to
occur, but if it does, the document is ranked higher in the list of search
results.
- `Paracetamol NEAR (~effect OR impact) AND ((side OR second*) NEAR/2 ~effect)`
looks for documents containing the word `paracetamol` near (within 10 words)
to words either starting with `effect` (and so also `effects`) or `impact`.
In addition, the document needs to contain the word `side` or any word
starting with `second` located within two words range of any word starting
with `effect`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment