8 **notmuch** **count** [option ...] <*search-term*> ...
10 **notmuch** **dump** [--format=(batch-tag|sup)] [--] [--output=<*file*>] [--] [<*search-term*> ...]
12 **notmuch** **reindex** [option ...] <*search-term*> ...
14 **notmuch** **search** [option ...] <*search-term*> ...
16 **notmuch** **show** [option ...] <*search-term*> ...
18 **notmuch** **tag** +<*tag*> ... -<*tag*> [--] <*search-term*> ...
23 Several notmuch commands accept a common syntax for search terms.
25 The search terms can consist of free-form text (and quoted phrases)
26 which will match all messages that contain all of the given
27 terms/phrases in the body, the subject, or any of the sender or
30 As a special case, a search string consisting of exactly a single
31 asterisk ("\*") will match all messages.
36 In addition to free text, the following prefixes can be used to force
37 terms to match against specific portions of an email, (where <brackets>
38 indicate user-supplied values).
40 If notmuch is built with **Xapian Field Processors** (see below) some
41 of the prefixes with <regex> forms can be also used to restrict the
42 results to those whose value matches a regular expression (see
43 **regex(7)**) delimited with //, for example::
45 notmuch search 'from:/bob@.*[.]example[.]com/'
47 from:<name-or-address> or from:/<regex>/
48 The **from:** prefix is used to match the name or address of
49 the sender of an email message.
52 The **to:** prefix is used to match the names or addresses of any
53 recipient of an email message, (whether To, Cc, or Bcc).
55 subject:<word-or-quoted-phrase> or subject:/<regex>/
56 Any term prefixed with **subject:** will match only text from the
57 subject of an email. Searching for a phrase in the subject is
58 supported by including quotation marks around the phrase,
59 immediately following **subject:**.
62 The **attachment:** prefix can be used to search for specific
63 filenames (or extensions) of attachments to email messages.
66 The **mimetype:** prefix will be used to match text from the
67 content-types of MIME parts within email messages (as specified by
70 tag:<tag> or tag:/<regex>/ or is:<tag> or is:/<regex>/
71 For **tag:** and **is:** valid tag values include **inbox** and
72 **unread** by default for new messages added by **notmuch new** as
73 well as any other tag values added manually with **notmuch tag**.
75 id:<message-id> or mid:<message-id> or mid:/<regex>/
76 For **id:** and **mid:**, message ID values are the literal
77 contents of the Message-ID: header of email messages, but without
78 the '<', '>' delimiters.
81 The **thread:** prefix can be used with the thread ID values that
82 are generated internally by notmuch (and do not appear in email
83 messages). These thread ID values can be seen in the first column
84 of output from **notmuch search**
86 path:<directory-path> or path:<directory-path>/** or path:/<regex>/
87 The **path:** prefix searches for email messages that are in
88 particular directories within the mail store. The directory must
89 be specified relative to the top-level maildir (and without the
90 leading slash). By default, **path:** matches messages in the
91 specified directory only. The "/\*\*" suffix can be used to match
92 messages in the specified directory and all its subdirectories
93 recursively. **path:""** matches messages in the root of the mail
94 store and, likewise, **path:\*\*** matches all messages.
96 **path:** will find a message if *any* copy of that message is in
97 the specific directory.
99 folder:<maildir-folder> or folder:/<regex>/
100 The **folder:** prefix searches for email messages by maildir or
101 MH folder. For MH-style folders, this is equivalent to
102 **path:**. For maildir, this includes messages in the "new" and
103 "cur" subdirectories. The exact syntax for maildir folders depends
104 on your mail configuration. For maildir++, **folder:""** matches
105 the inbox folder (which is the root in maildir++), other folder
106 names always start with ".", and nested folders are separated by
107 "."s, such as **folder:.classes.topology**. For "file system"
108 maildir, the inbox is typically **folder:INBOX** and nested
109 folders are separated by slashes, such as
110 **folder:classes/topology**.
112 **folder:** will find a message if *any* copy of that message is
113 in the specific folder.
115 date:<since>..<until> or date:<date>
116 The **date:** prefix can be used to restrict the results to only
117 messages within a particular time range (based on the Date:
120 See **DATE AND TIME SEARCH** below for details on the range
121 expression, and supported syntax for <since> and <until> date and
124 The time range can also be specified using timestamps with a
127 <initial-timestamp>..<final-timestamp>
129 Each timestamp is a number representing the number of seconds
130 since 1970-01-01 00:00:00 UTC.
132 lastmod:<initial-revision>..<final-revision>
133 The **lastmod:** prefix can be used to restrict the result by the
134 database revision number of when messages were last modified (tags
135 were added/removed or filenames changed). This is usually used in
136 conjunction with the **--uuid** argument to **notmuch search** to
137 find messages that have changed since an earlier query.
140 The **query:** prefix allows queries to refer to previously saved
141 queries added with **notmuch-config(1)**. Named queries are only
142 available if notmuch is built with **Xapian Field Processors**
145 property:<key>=<value>
146 The **property:** prefix searches for messages with a particular
147 <key>=<value> property pair. Properties are used internally by
148 notmuch (and extensions) to add metadata to messages. A given key
149 can be present on a given message with several different values.
150 See **notmuch-properties(7)** for more details.
155 In addition to individual terms, multiple terms can be combined with
156 Boolean operators (**and**, **or**, **not**, and **xor**). Each term
157 in the query will be implicitly connected by a logical AND if no
158 explicit operator is provided (except that terms with a common prefix
159 will be implicitly combined with OR). The shorthand '-<term>' can be
160 used for 'not <term>' but unfortunately this does not work at the
161 start of an expression. Parentheses can also be used to control the
162 combination of the Boolean operators, but will have to be protected
163 from interpretation by the shell, (such as by putting quotation marks
164 around any parenthesized expression).
166 In addition to the standard boolean operators, Xapian provides several
167 operators specific to text searching.
171 notmuch search term1 NEAR term2
173 will return results where term1 is within 10 words of term2. The
174 threshold can be set like this:
178 notmuch search term1 NEAR/2 term2
184 notmuch search term1 ADJ term2
186 will return results where term1 is within 10 words of term2, but in the
187 same order as in the query. The threshold can be set the same as with
192 notmuch search term1 ADJ/7 term2
198 **Stemming** in notmuch means that these searches
202 notmuch search detailed
203 notmuch search details
204 notmuch search detail
206 will all return identical results, because Xapian first "reduces" the
207 term to the common stem (here 'detail') and then performs the search.
209 There are two ways to turn this off: a search for a capitalized word
210 will be performed unstemmed, so that one can search for "John" and not
211 get results for "Johnson"; phrase searches are also unstemmed (see
212 below for details). Stemming is currently only supported for
213 English. Searches for words in other languages will be performed unstemmed.
218 It is possible to use a trailing '\*' as a wildcard. A search for
219 'wildc\*' will match 'wildcard', 'wildcat', etc.
222 Boolean and Probabilistic Prefixes
223 ----------------------------------
225 Xapian (and hence notmuch) prefixes are either **boolean**, supporting
226 exact matches like "tag:inbox" or **probabilistic**, supporting a more
227 flexible **term** based searching. Certain **special** prefixes are
228 processed by notmuch in a way not strictly fitting either of Xapian's
229 built in styles. The prefixes currently supported by notmuch are as
233 **tag:**, **id:**, **thread:**, **folder:**, **path:**, **property:**
235 **to:**, **attachment:**, **mimetype:**
237 **from:**, **query:**, **subject:**
242 In general Xapian distinguishes between lists of terms and
243 **phrases**. Phrases are indicated by double quotes (but beware you
244 probably need to protect those from your shell) and insist that those
245 unstemmed words occur in that order. One useful, but initially
246 surprising feature is that the following are equivalent ways to write
254 Both parenthesised lists of terms and quoted phrases are ok with
255 probabilistic prefixes such as **to:**, **from:**, and **subject:**. In particular
265 subject:pizza and subject:free
267 Both of these will match a subject "Free Delicious Pizza" while
278 notmuch understands a variety of standard and natural ways of expressing
279 dates and times, both in absolute terms ("2012-10-24") and in relative
280 terms ("yesterday"). Any number of relative terms can be combined ("1
281 hour 25 minutes") and an absolute date/time can be combined with
282 relative terms to further adjust it. A non-exhaustive description of the
283 syntax supported for absolute and relative terms is given below.
288 date:<since>..<until>
290 The above expression restricts the results to only messages from <since>
291 to <until>, based on the Date: header.
293 <since> and <until> can describe imprecise times, such as "yesterday".
294 In this case, <since> is taken as the earliest time it could describe
295 (the beginning of yesterday) and <until> is taken as the latest time it
296 could describe (the end of yesterday). Similarly, date:january..february
297 matches from the beginning of January to the end of February.
299 date:<expr>..! can be used as a shorthand for date:<expr>..<expr>. The
300 expansion takes place before interpretation, and thus, for example,
301 date:monday..! matches from the beginning of Monday until the end of
303 With **Xapian Field Processor** support (see below), non-range
304 date queries such as date:yesterday will work, but otherwise
305 will give unexpected results; if in doubt use date:yesterday..!
307 Currently, we do not support spaces in range expressions. You can
308 replace the spaces with '\_', or (in most cases) '-', or (in some cases)
309 leave the spaces out altogether. Examples in this man page use spaces
312 Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's possible
313 to specify date:..<until> or date:<since>.. to not limit the start or
314 end time, respectively. Pre-1.2.1 Xapian does not report an error on
315 open ended ranges, but it does not work as expected either.
317 Relative date and time
318 ----------------------
321 (years\|months\|weeks\|days\|hours\|hrs\|minutes\|mins\|seconds\|secs)
324 All refer to past, can be repeated and will be accumulated.
326 Units can be abbreviated to any length, with the otherwise ambiguous
327 single m being m for minutes and M for months.
329 Number can also be written out one, two, ..., ten, dozen, hundred.
330 Additionally, the unit may be preceded by "last" or "this" (e.g., "last
331 week" or "this month").
333 When combined with absolute date and time, the relative date and time
334 specification will be relative from the specified absolute date and
337 Examples: 5M2d, two weeks
339 Supported absolute time formats
340 -------------------------------
342 - H[H]:MM[:SS] [(am\|a.m.\|pm\|p.m.)]
344 - H[H] (am\|a.m.\|pm\|p.m.)
354 - Examples: 17:05, 5pm
356 Supported absolute date formats
357 -------------------------------
371 - D[D][(st\|nd\|rd\|th)] Mon[thname] [YYYY]
373 - Mon[thname] D[D][(st\|nd\|rd\|th)] [YYYY]
377 Month names can be abbreviated at three or more characters.
379 Weekday names can be abbreviated at three or more characters.
381 Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3
390 Some time zone codes, e.g. UTC, EET.
392 XAPIAN FIELD PROCESSORS
393 =======================
395 Certain optional features of the notmuch query processor rely on the
396 presence of the Xapian field processor API. You can determine if your
397 notmuch was built against a sufficiently recent version of Xapian by running
401 % notmuch config get built_with.field_processor
403 Currently the following features require field processor support:
405 - non-range date queries, e.g. "date:today"
406 - named queries e.g. "query:my_special_query"
407 - regular expression searches, e.g. "subject:/^\\[SPAM\\]/"
413 **notmuch-config(1)**,
414 **notmuch-count(1)**,
416 **notmuch-hooks(5)**,
417 **notmuch-insert(1)**,
419 **notmuch-reindex(1)**,
420 **notmuch-properties(1)**,
421 ***notmuch-reply(1)**,
422 **notmuch-restore(1)**,
423 **notmuch-search(1)**,
424 ***notmuch-show(1)**,