Home | Appendix

|  |  | Search Prefixes

DEVONthink supports a wide variety of searchable attributes. These include common attributes, like names or tags, but also include document or DEVONthink-specific items, like word counts or custom metadata you've defined. Similar to searching with Spotlight or some other applications, the use of search prefixes is supported. These take the form of a prefix and a prefix operator, e.g., `name:`, followed by the search term. These prefixes are automatically applied when you choose criteria in an advanced search but they can also be manually entered in the search field. Search prefixes Below is a list of the available search field prefixes as you would manually type into the search field or a script: text: Text contents in a file. metadata: The metadata for a file. name: The name of an item. For documents, this is distinct from the filename and does not include the file extension. url: The associated URL. comment: Spotlight Comments. docAuthors: The name of the sender of an email. docAuthorEmailAddresses: The email address of the sender of an email. docRecipients: The name of a recipient of an email. docRecipientEmailAddresses: The email address of a recipient of an email. docTitle: The title of a file. The title may be distinct from its name, e.g., a song title for an MP3 file. docComment: The RTF-specific comments for a file. docHeadline: A headline applied to some files. Rare. docSubject: The subject line from an email. docDescription: The description found on some files, typically images. docKeywords: The PDF or RTF specific keywords for a file. docOrganization: The company specified in imported links or vCards from the Contacts application. docCopyright: Copyright information in the metadata of a file. docAlbum: The album information from media metadata, e.g., MP3 files. docComposer: The composer information from media metadata, e.g., MP3 files. docCreator: The process or application used to create a file. docProducer: The producer of a file, usually applied to media files. aliases: Aliases applied to an item. tags: Tags applied to an item. label: The color label of an item, from 0 (no label) though 7 or by name, e.g., Important. rating: The star rating of an item, from 0 (unrated) through 5. width: The width of a document in points, i.e., the width multiplied by 72. height: The height of a document in points, i.e., the height multiplied by 72. length: The number of pages in a file or length of a media file in seconds. size: The size of an item in bytes, KB, MB, or GB, e.g., `size >= 50 MB`. wordcount: The number of words in the contents of a file. charactercount: The number of characters in the contents of a file. hits: The number of times a file has been viewed or opened. filename: The name of the file in the file system, including the file extension. extension: The extension of a file, e.g., txt. This also supports an Any Extension option to filter filenames having or lacking an extension. kind: Supports `any`, `group`, `smartgroup`, `tag`, `ordinarytag`, `grouptag`, `text`, `rtf`, `formattednote`, `markdown`, `html`, `webarchive`, `xmlfile`, `propertylist`, `image`, `pdf`, `quicktime`, `video`, `audio`, `bookmark`, `feed`, `news`, `script`, `sheet`, `email`, and `other`. Item prefixes: These special prefixes are for state-based queries, like if items are replicants or contains aliases. They all follow the form of `item:<specified state>`, e.g., `item:locked`. You can specify the state of items, i.e., is or is not. The available options are as follows: Replicated: Matches items that are replicants. Duplicated: Matches items that are duplicates. Indexed: Matches items that are indexed, not imported. Pending: Matches items whose contents aren't downloaded and available. Tagged: Matches items with tags applied. The other option is specifying whether items do or don't contain a certain property. For example, you can search for items containing aliases and the `item:<specified state>` syntax is also used. This includes the negated form. Here are the searchable properties: Aliases: Matches items with aliases. Annotation: Matches items with an associated annotation file. Comment: Matches items with a Finder comment. Data: Matches items with child items, e.g., a group with items contains data. An empty group can be found via `item!:data`, meaning the item does not contain data. Metadata: Matches items with metadata. Reminder: Matches items with a reminder set. (See Annotations & Reminders) Script: Matches items with a script applied in the Info inspector. Thumbnail: Matches items with a thumbnail applied. URL: Matches items with a URL set in the Info inspector. Marked: Item states shown in the Flag column in the item list, e.g., locked, can be searched for. When choosing criteria in the Advanced options of the toolbar search, choose the Marked criterion. If using a raw query string, the search prefix is `item:<specified state>` and it's negated form, `item!:<specified state>`. Here are the marking options available: Flag: The flag state of an item. Supports `flagged` or `unflagged`. Unread: The unread state of an item. Supports `read` or `unread`. Locking: The locking state of an item. Supports `locked` or `unlocked`. Dates: Dates are a very commonly used property in searches, for example, if you're looking for a document you created two days ago. Here are the date-based properties you can search for. See the Date Operators in the next section for the syntax you can use with these. added: The date the item was added to the database. The long form `additionDate` is also supported. created: The date the item was created. The long form `creationDate` is also supported. modified: The date the item was last modified. The long form `modificationDate` is also supported. opened: The date the item was last opened. The long form `openingDate` is also supported. due: The due date set in a Reminder for an item. The long form `dueDate` is also supported. Miscellaneous Properties: There are also some a bit more esoteric attributes you can search for, like the number of attachments in emails, or the detected language of a document. md_attachments: The number of attachments in an email or the number of resources added to an RTFD file. md_annotationcount: The number of annotations set in a PDF file. md_encrypted: The encrypted state of a PDF. This is a Boolean value denoted numerically, e.g., `md_encrypted==1` when a file is encrypted. md_incomingItemLinkCount: The number of item links to a document from other documents in DEVONthink. md_outgoingItemLinkCount: The number of item links to other documents present in a document. md_language: An abbreviation of the detected language in the contents of a file. For a list of values, select a language in the criteria and note the abbreviation to use. md_country: An abbreviation of the country in the geolocation data for a file. For a list of values, select a country in the criteria and note the abbreviation to use. md_zipcode: The postal code detected in the geolocation data for a file. md_area: The state, province, or region detected in the geolocation data for a file. md_locality: The city detected in the geolocation data for a file. PRO Custom Metadata: Any custom metadata attributes defined in the Data settings are also available as search prefixes. The search prefix you will type is a concatenated form of the attribute's name, prefixed with `md`. For example, an attribute of `Total Cost` would have a search prefix of `mdtotalcost`. There are also two special prefixes you can use: scope: This limits where you are searching. It supports `selection` (the current group or database), referring to a database by name (in quotes), and `inboxes`. If no scope is specified, the search applies to all open databases. When used, `scope:` should be the last parameter in the query. any: When used, this allows you to specify whether to return results matching any of the criteria. This can only be used when specifying more than one search prefix, e.g., tags and filename.
Example: `additionDate>=2019-03-10 scope:selection` `tags:sync; methods scope:"Tech Stuff"` `any: name:test OR imprint {any: tags:blue; red}`
Sub-criteria searches: Yes, you may have noticed in the last example a tags search in curly braces. This creates sub-criteria for the search. This obviously extends the search options to allow creating even more complex forms. Prefix Operators Many times prefixes end with a colon, e.g., `tags:` but some use other forms, depending on the available options in the criterion. For example, words can "begin with" some characters, but a size is greater or less than a value. If you select a criterion you would see what options apply. Use the keys below to map the option to its operator. Matches, Is, Is Not: `:` is equal to the term matches. With strings-based queries, it allows for wildcards to be used. It is also used for state-based queries, like Kind. The negated form, `:!` is also supported. `==` is equal to the term is. This must be an exact match of the search term. These can be used in strings and number-based queries. The negated form, `!=` is also supported.
Example: Kind is Group → `kind:group` Item is indexed → `item:indexed` Item is not Replicated → `item:!replicated` Extension is XML Document → `extension==XML` Language is not English → `language!=en`
String Matching: These are operators that are used with string-based queries, like names or text content. These queries also support: `:<` is equal to begins with. `:>` is equal to ends with. `:~` is equal to contains. (The tilde is the second key down on the top left of an English keyboard.)
Example: Subject begins with party → `docSubject:<party` Locality ends with field → `md_locality:>field` Name contains tech → `name:~tech`
Number Matching: In addition to the `==` and `!=` operators, numbers can also use these operators: `<` is equal to is less than and `<=` is is less than or equal to. `>` is equal to is greater than and `>=` is is greater than or equal to.
Example: Word Count is less than 1000 → `wordcount<1000` Size is greater than 10MB → `size>10 MB` Hits is greater than or equal to 1 → `hits>=1`
Range Matches: For certain numerical attributes, you can use a range matching syntax, `attibute:lowerLimit-upperLimit`. For example, `wordcount:500-1000` matches files with between 500 and 1000 words. This is identical to the longer form syntax of `wordcount>=500 wordcount<=1000`. Range matches can be used with: width, height, duration, length, hits, wordcount, charactercount, and size prefixes. Date Operators: These are operators used with date-based queries, like the creation date of files. `<` is equal to before and `<=` is before or on. `>` is equal to later and `>=` is later or on. `:#` is equal to within last and `:!#` is not within last. These searches default to days, but you can also use weeks, months, or years. For example, `modified:!#1weeks`, noting you always use the plural form of the time component. For dates-based queries, `:` is equal to is and `:!` equals is not. For greater compatibility, some other combinations of operators are allowed. `due:<=2020-01-03` is equivalent to `due<=2020-01-03`. Named Relative Dates: You can use these terms for relative dates: Today, Yesterday, This Week, Last Week, This Month, Last Month, This Quarter, Last Quarter, This Year, and Last Year. Use these with is, before (or on), and after (or on) operators.
Example: Date Created is after January 31, 2019 → `created:>=2019-01-31` Date opened is not within last 5 days → `openingDate:!#5days` Date Due is not Today → `due:!Today`
Date searching allows for some flexibility in formats. Time is not a required parameter, but can be specified. These searches are all equivalent:
Example: `additionDate>10 march, 2019` `additionDate>March 10, 19` `additionDate>2019-03-10 08:30:00 -0500`