1 .TH NOTMUCH-SEARCH-TERMS 7 2012-03-19 "Notmuch 0.12"
4 notmuch-search-terms \- Syntax for notmuch queries
10 .RI < search-term ">..."
13 .RI "[ <" filename "> ] [--]"
14 .RI "[ <" search-term ">...]"
17 .RI [ options "...] <" search-term ">..."
20 .RI "[" options "...] <" search-term ">..."
23 .RI "+<" tag> "|\-<" tag "> [...] [\-\-] <" search-term ">..."
27 Several notmuch commands accept a common syntax for search terms.
29 The search terms can consist of free-form text (and quoted phrases)
30 which will match all messages that contain all of the given
31 terms/phrases in the body, the subject, or any of the sender or
34 As a special case, a search string consisting of exactly a single
35 asterisk ("*") will match all messages.
37 In addition to free text, the following prefixes can be used to force
38 terms to match against specific portions of an email, (where
39 <brackets> indicate user-supplied values):
41 from:<name-or-address>
45 subject:<word-or-quoted-phrase>
49 tag:<tag> (or is:<tag>)
55 folder:<directory-path>
59 prefix is used to match the name or address of the sender of an email
64 prefix is used to match the names or addresses of any recipient of an
65 email message, (whether To, Cc, or Bcc).
67 Any term prefixed with
69 will match only text from the subject of an email. Searching for a
70 phrase in the subject is supported by including quotation marks around
71 the phrase, immediately following
76 prefix can be used to search for specific filenames (or extensions) of
77 attachments to email messages.
81 valid tag values include
82 .BR inbox " and " unread
83 by default for new messages added by
85 as well as any other tag values added manually with
90 message ID values are the literal contents of the Message\-ID: header
91 of email messages, but without the '<', '>' delimiters.
95 prefix can be used with the thread ID values that are generated
96 internally by notmuch (and do not appear in email messages). These
97 thread ID values can be seen in the first column of output from
102 prefix can be used to search for email message files that are
103 contained within particular directories within the mail store. Only
104 the directory components below the top-level mail database path are
105 available to be searched.
107 In addition to individual terms, multiple terms can be
108 combined with Boolean operators (
109 .BR and ", " or ", " not
110 , etc.). Each term in the query will be implicitly connected by a
111 logical AND if no explicit operator is provided, (except that terms
112 with a common prefix will be implicitly combined with OR until we get
113 Xapian defect #402 fixed).
115 Parentheses can also be used to control the combination of the Boolean
116 operators, but will have to be protected from interpretation by the
117 shell, (such as by putting quotation marks around any parenthesized
120 Finally, results can be restricted to only messages within a
121 particular time range, (based on the Date: header) with a syntax of:
123 <initial-timestamp>..<final-timestamp>
125 Each timestamp is a number representing the number of seconds since
126 1970\-01\-01 00:00:00 UTC. This is not the most convenient means of
127 expressing date ranges, but until notmuch is fixed to accept a more
128 convenient form, one can use the date program to construct
129 timestamps. For example, with the bash shell the following syntax would
130 specify a date range to return messages from 2009\-10\-01 until the
133 $(date +%s \-d 2009\-10\-01)..$(date +%s)
137 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
138 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5), \fBnotmuch-new\fR(1),
139 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
140 \fBnotmuch-search\fR(1), \fBnotmuch-show\fR(1), \fBnotmuch-tag\fR(1)