Skip to content
Quarryv1.4

    Start free
    Documentation menu

    Query syntax

    Quoted phrases, boolean operators, field filters and wildcards, with worked examples.

    Quarry’s query syntax is built for typing searches quickly, not for constructing arbitrary structured queries. A bare word matches that word anywhere. Everything past that is optional.

    Bare words

    quarry search invoice

    Matches any document containing the word invoice, case-insensitively. Multiple bare words are treated as an implicit AND:

    quarry search invoice march

    Matches documents containing both invoice and march, in any order, anywhere in the file.

    Quoted phrases

    Wrap a phrase in double quotes to match the exact sequence of words.

    quarry search "quarterly invoice"

    This matches quarterly invoice as adjacent words, not documents that merely contain both words separately. From a shell, remember to quote the whole argument so the shell does not strip the inner quotes:

    quarry search '"quarterly invoice"'

    Boolean operators

    AND, OR and NOT are recognized in uppercase. Lowercase and/or/not are treated as ordinary search words, not operators, so a search for the word “and” itself still works as expected.

    quarry search "invoice AND NOT draft"
    quarry search "invoice OR receipt"

    Operators combine left to right unless grouped with parentheses:

    quarry search "(invoice OR receipt) AND march"
    Operator Meaning
    AND Both sides must match. Implicit between bare words.
    OR Either side may match.
    NOT Excludes documents matching the right side.
    ( ) Groups a sub-expression to control evaluation order.

    Field filters

    Restrict a search to a path, an extension, or a modification time, using field:value.

    quarry search "path:invoices/ invoice"
    quarry search "ext:md project"
    quarry search "modified:>2026-06-01 invoice"
    Field Example Matches
    path: path:invoices/ Files whose path contains this substring.
    ext: ext:md Files with this extension, without the dot.
    modified: modified:>2026-06-01 Files modified after this date. < and >=/<= also work.
    size: size:>1mb Files larger than the given size. kb, mb and gb are recognized.

    Field filters combine with bare words and operators normally:

    quarry search "ext:md AND path:notes/ AND (meeting OR standup)"

    Wildcards

    A trailing * matches any suffix on a word.

    quarry search "invoic*"

    Matches invoice, invoices, and invoicing. A wildcard is not supported at the start of a word; *oice is treated as a literal search for the text *oice, which will not match anything useful.

    Escaping

    To search for a literal word that would otherwise be read as an operator or a field prefix, wrap it in quotes:

    quarry search '"AND"'
    quarry search '"path:example"'

    Case and punctuation

    Search is case-insensitive throughout. Punctuation inside a word, like a hyphen or an underscore, is treated as a word boundary during indexing, so invoice-2026 is searchable as either invoice or 2026 individually, or as the exact phrase "invoice-2026".

    Empty and invalid queries

    An empty query returns no results and exits with code 2, the same as any other bad usage; see Exit codes. Unbalanced parentheses or a trailing operator, like a query ending in AND, are reported with a one-line parse error pointing at the offending token.

    quarry search "invoice AND"
    error: query ends with an operator, expected a term after "AND"

    Using the same syntax over HTTP

    The HTTP endpoint, Pro only, accepts the identical grammar in its q parameter, URL encoded:

    curl '127.0.0.1:7433/search?q=ext%3Amd%20AND%20invoice'

    Saving a query

    Any query that works with quarry search can be saved for reuse without retyping it. See Saved searches for the quarry saved command and its limits on the Free plan.

    A worked example

    Finding markdown notes about a March invoice, excluding drafts, modified in the last month:

    quarry search 'ext:md AND "march invoice" AND NOT draft AND modified:>2026-06-01'

    Reading it left to right: restrict to markdown files, require the exact phrase, exclude anything containing the word draft, and require a recent modification date. Each clause narrows the result set independently of the others; there is no implicit weighting from clause order. For how matches are scored once found, see Ranking.

    Edit this page

    Last updated Jul 28, 2026