1 .TH NOTMUCH-SEARCH-TERMS 7 2013-08-03 "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. If the
106 same email message has multiple message files associated with it, it's
107 sufficient for a match that at least one of the files is contained
108 within a matching directory. Only the directory components below the
109 top-level mail database path are available to be searched.
113 prefix can be used to restrict the results to only messages within a
114 particular time range (based on the Date: header) with a range syntax
117 date:<since>..<until>
119 See \fBDATE AND TIME SEARCH\fR below for details on the range
120 expression, and supported syntax for <since> and <until> date and time
123 The time range can also be specified using timestamps with a syntax
126 <initial-timestamp>..<final-timestamp>
128 Each timestamp is a number representing the number of seconds since
129 1970\-01\-01 00:00:00 UTC.
131 In addition to individual terms, multiple terms can be
132 combined with Boolean operators (
133 .BR and ", " or ", " not
134 , etc.). Each term in the query will be implicitly connected by a
135 logical AND if no explicit operator is provided, (except that terms
136 with a common prefix will be implicitly combined with OR until we get
137 Xapian defect #402 fixed).
139 Parentheses can also be used to control the combination of the Boolean
140 operators, but will have to be protected from interpretation by the
141 shell, (such as by putting quotation marks around any parenthesized
144 .SH DATE AND TIME SEARCH
146 notmuch understands a variety of standard and natural ways of
147 expressing dates and times, both in absolute terms ("2012-10-24") and
148 in relative terms ("yesterday"). Any number of relative terms can be
149 combined ("1 hour 25 minutes") and an absolute date/time can be
150 combined with relative terms to further adjust it. A non-exhaustive
151 description of the syntax supported for absolute and relative terms is
156 .B The range expression
158 date:<since>..<until>
160 The above expression restricts the results to only messages from
161 <since> to <until>, based on the Date: header.
163 <since> and <until> can describe imprecise times, such as "yesterday".
164 In this case, <since> is taken as the earliest time it could describe
165 (the beginning of yesterday) and <until> is taken as the latest time
166 it could describe (the end of yesterday). Similarly,
167 date:january..february matches from the beginning of January to the
170 Currently, we do not support spaces in range expressions. You can
171 replace the spaces with '_', or (in most cases) '-', or (in some
172 cases) leave the spaces out altogether. Examples in this man page use
175 Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's
176 possible to specify date:..<until> or date:<since>.. to not limit the
177 start or end time, respectively. Pre-1.2.1 Xapian does not report an
178 error on open ended ranges, but it does not work as expected either.
180 Entering date:expr without ".." (for example date:yesterday) won't
181 work, as it's not interpreted as a range expression at all. You can
182 achieve the expected result by duplicating the expr both sides of ".."
183 (for example date:yesterday..yesterday).
188 .B Relative date and time
189 [N|number] (years|months|weeks|days|hours|hrs|minutes|mins|seconds|secs) [...]
191 All refer to past, can be repeated and will be accumulated.
193 Units can be abbreviated to any length, with the otherwise ambiguous
194 single m being m for minutes and M for months.
196 Number can also be written out one, two, ..., ten, dozen,
197 hundred. Additionally, the unit may be preceded by "last" or "this"
198 (e.g., "last week" or "this month").
200 When combined with absolute date and time, the relative date and time
201 specification will be relative from the specified absolute date and
204 Examples: 5M2d, two weeks
209 .B Supported absolute time formats
210 H[H]:MM[:SS] [(am|a.m.|pm|p.m.)]
212 H[H] (am|a.m.|pm|p.m.)
227 .B Supported absolute date formats
240 D[D][(st|nd|rd|th)] Mon[thname] [YYYY]
242 Mon[thname] D[D][(st|nd|rd|th)] [YYYY]
246 Month names can be abbreviated at three or more characters.
248 Weekday names can be abbreviated at three or more characters.
250 Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3
260 Some time zone codes, e.g. UTC, EET.
265 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
266 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5),
267 \fBnotmuch-insert\fR(1), \fBnotmuch-new\fR(1),
268 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
269 \fBnotmuch-search\fR(1), \fBnotmuch-show\fR(1), \fBnotmuch-tag\fR(1)