Home

Appendix

Application Icon   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:

  • Icon
    text: Text contents in a file.
  • Icon
    metadata: The metadata for a file.
  • Icon
    name: The name of a file. This is distinct from the filename and does not include the file extension.
  • Icon
    url: The associated URL.
  • Icon
    comment: Spotlight Comments.
  • Icon
    docAuthors: The name of the sender of an email.
  • Icon
    docAuthorEmailAddresses: The email address of the sender of an email.
  • Icon
    docRecipients: The name of a recipient of an email.
  • Icon
    docRecipientEmailAddresses: The email address of a recipient of an email.
  • Icon
    docTitle: The title of a file. The title may be distinct from its name, e.g., a song title for an MP3 file.
  • Icon
    docComment: The RTF-specific comments for a file.
  • Icon
    docHeadline: A headline applied to some files. Rare.
  • Icon
    docSubject: The subject line from an email.
  • Icon
    docDescription: The description found on some files, typically images.
  • Icon
    docKeywords: The PDF or RTF specific keywords for a file.
  • Icon
    docOrganization: The company specified in imported links or vCards from the Contacts application.
  • Icon
    docCopyright: Copyright information in the metadata of a file.
  • Icon
    docAlbum: The album information from media metadata, e.g., MP3 files.
  • Icon
    docComposer: The composer information from media metadata, e.g., MP3 files.
  • Icon
    docCreator: The process or application used to create a file.
  • Icon
    docProducer: The producer of a file, usually applied to media files.
  • Icon
    aliases: Aliases applied to a file.
  • Icon
    tags: Tags applied to a file.
  • Icon
    label: The color label of a file, from 0 (no label) though 7 or by name, e.g., Important.
  • Icon
    rating: The star rating of a file, from 0 (unrated) through 5.
  • Icon
    width: The width of a document in points, i.e., the width multiplied by 72.
  • Icon
    height: The height of a document in points, i.e., the height multiplied by 72.
  • Icon
    length: The number of pages in a file or length of a media file in seconds.
  • Icon
    size: The size of a file in bytes, KB, MB, or GB, e.g., size >= 50 MB.
  • Icon
    wordcount: The number of words in the contents of a file.
  • Icon
    charactercount: The number of characters in the contents of a file.
  • Icon
    hits: The number of times a file has been viewed or opened.
  • Icon
    filename: The name of the file in the file system, including the file extension.
  • Icon
    extension: The extension of a file, e.g., txt. This also supports an Any Extension option to filter filenames having or lacking an extension.
  • Icon
    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 the locked or indexed state of items. They all follow the form of item:<specified state>, e.g., item:locked. However, when choosing criteria in the Advanced options of the toolbar search, choose the Marked option for the Flagged, Unread, and Locking states. The search prefix item: is still shown these options.

  • Icon
    Flag: The flag state of a file. Supports flagged or unflagged.
  • Icon
    Unread: The unread state of a file. Supports read or unread.
  • Icon
    Locking: The locking state of a file. Supports locked or unlocked.
  • Icon
    Item: A special item supporting instance states: replicated, duplicated, indexed, pending, or tagged.
  • Icon
    additionDate: The date the file was added to the database.
  • Icon
    creationDate: The date the file was created.
  • Icon
    modificationDate: The date the file was last modified.
  • Icon
    openingDate: The date the file was last opened.
  • Icon
    dueDate: The due date set in a Reminder for a file.
  • Icon
    md_attachments: The number of attachments in an email or the number of resources added to an RTFD file.
  • Icon
    md_annotationcount: The number of annotations set in a PDF file.
  • Icon
    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.
  • Icon
    md_incomingItemLinkCount: The number of item links to a document from other documents in DEVONthink.
  • Icon
    md_outgoingItemLinkCount: The number of item links to other documents present in a document.
  • Icon
    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.
  • Icon
    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.
  • Icon
    md_zipcode: The postal code detected in the geolocation data for a file.
  • Icon
    md_area: The state, province, or region detected in the geolocation data for a file.
  • Icon
    md_locality: The city detected in the geolocation data for a file.
PRO

Custom Metadata: Any custom metadata attributes defined in Read more... 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:

  • Icon
    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.
  • Icon
    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 the term is less than.

<= is equal to the term is less than or equal to.

> is equal to the term is greater than.

>= is equal to the term 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 the term before.

<= is equal to the term before or on.

> is equal to the term later.

>= is equal to the term later or on.

:# is equal to the term within last number of days. The negated form, :!# is also supported.

: is equal to the term is for date-based queries. Supported date options are Today, Yesterday, This Week, Last Week, This Month, Last Month, This Quarter, Last Quarter, This Year, and Last Year. The negated form, :! is also supported.

Example:


Date Created is after January 31, 2019 → creationDate>=2019-01-31
Date opened is not within last 5 days → openingDate:!#5days
Date Due is not Today → dueDate:!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