1 .TH NOTMUCH-SEARCH-TERMS 7 2013-07-28 "Notmuch 0.16"
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>
61 prefix is used to match the name or address of the sender of an email
66 prefix is used to match the names or addresses of any recipient of an
67 email message, (whether To, Cc, or Bcc).
69 Any term prefixed with
71 will match only text from the subject of an email. Searching for a
72 phrase in the subject is supported by including quotation marks around
73 the phrase, immediately following
78 prefix can be used to search for specific filenames (or extensions) of
79 attachments to email messages.
83 valid tag values include
84 .BR inbox " and " unread
85 by default for new messages added by
87 as well as any other tag values added manually with
92 message ID values are the literal contents of the Message\-ID: header
93 of email messages, but without the '<', '>' delimiters.
97 prefix can be used with the thread ID values that are generated
98 internally by notmuch (and do not appear in email messages). These
99 thread ID values can be seen in the first column of output from
104 prefix can be used to search for email message files that are
105 contained within particular directories within the mail store. Only
106 the directory components below the top-level mail database path are
107 available to be searched.
111 prefix can be used to restrict the results to only messages within a
112 particular time range (based on the Date: header) with a range syntax
115 date:<since>..<until>
117 See \fBDATE AND TIME SEARCH\fR below for details on the range
118 expression, and supported syntax for <since> and <until> date and time
121 The time range can also be specified using timestamps with a syntax
124 <initial-timestamp>..<final-timestamp>
126 Each timestamp is a number representing the number of seconds since
127 1970\-01\-01 00:00:00 UTC.
129 In addition to individual terms, multiple terms can be
130 combined with Boolean operators (
131 .BR and ", " or ", " not
132 , etc.). Each term in the query will be implicitly connected by a
133 logical AND if no explicit operator is provided, (except that terms
134 with a common prefix will be implicitly combined with OR until we get
135 Xapian defect #402 fixed).
137 Parentheses can also be used to control the combination of the Boolean
138 operators, but will have to be protected from interpretation by the
139 shell, (such as by putting quotation marks around any parenthesized
142 .SH DATE AND TIME SEARCH
144 notmuch understands a variety of standard and natural ways of
145 expressing dates and times, both in absolute terms ("2012-10-24") and
146 in relative terms ("yesterday"). Any number of relative terms can be
147 combined ("1 hour 25 minutes") and an absolute date/time can be
148 combined with relative terms to further adjust it. A non-exhaustive
149 description of the syntax supported for absolute and relative terms is
154 .B The range expression
156 date:<since>..<until>
158 The above expression restricts the results to only messages from
159 <since> to <until>, based on the Date: header.
161 <since> and <until> can describe imprecise times, such as "yesterday".
162 In this case, <since> is taken as the earliest time it could describe
163 (the beginning of yesterday) and <until> is taken as the latest time
164 it could describe (the end of yesterday). Similarly,
165 date:january..february matches from the beginning of January to the
168 Currently, we do not support spaces in range expressions. You can
169 replace the spaces with '_', or (in most cases) '-', or (in some
170 cases) leave the spaces out altogether. Examples in this man page use
173 Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's
174 possible to specify date:..<until> or date:<since>.. to not limit the
175 start or end time, respectively. Pre-1.2.1 Xapian does not report an
176 error on open ended ranges, but it does not work as expected either.
178 Entering date:expr without ".." (for example date:yesterday) won't
179 work, as it's not interpreted as a range expression at all. You can
180 achieve the expected result by duplicating the expr both sides of ".."
181 (for example date:yesterday..yesterday).
186 .B Relative date and time
187 [N|number] (years|months|weeks|days|hours|hrs|minutes|mins|seconds|secs) [...]
189 All refer to past, can be repeated and will be accumulated.
191 Units can be abbreviated to any length, with the otherwise ambiguous
192 single m being m for minutes and M for months.
194 Number can also be written out one, two, ..., ten, dozen,
195 hundred. Additionally, the unit may be preceded by "last" or "this"
196 (e.g., "last week" or "this month").
198 When combined with absolute date and time, the relative date and time
199 specification will be relative from the specified absolute date and
202 Examples: 5M2d, two weeks
207 .B Supported absolute time formats
208 H[H]:MM[:SS] [(am|a.m.|pm|p.m.)]
210 H[H] (am|a.m.|pm|p.m.)
225 .B Supported absolute date formats
238 D[D][(st|nd|rd|th)] Mon[thname] [YYYY]
240 Mon[thname] D[D][(st|nd|rd|th)] [YYYY]
244 Month names can be abbreviated at three or more characters.
246 Weekday names can be abbreviated at three or more characters.
248 Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3
258 Some time zone codes, e.g. UTC, EET.
263 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
264 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5),
265 \fBnotmuch-insert\fR(1), \fBnotmuch-new\fR(1),
266 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
267 \fBnotmuch-search\fR(1), \fBnotmuch-show\fR(1), \fBnotmuch-tag\fR(1)