results to those whose value matches a regular expression (see
<b>regex</b>(7)) delimited with //, for example:
- notmuch search 'from:/bob@.*[.]example[.]com/'
+ notmuch search 'from:"/bob@.*[.]example[.]com/"'
<b>from:<name-or-address></b> <b>or</b> <b>from:/<regex>/</b>
The <b>from:</b> prefix is used to match the name or address of the
messages). These thread ID values can be seen in the first col‐
umn of output from <b>notmuch</b> <b>search</b>
+ <b>thread:{<notmuch</b> <b>query>}</b>
+ If notmuch is built with <b>Xapian</b> <b>Field</b> <b>Processors</b> (see below),
+ threads may be searched for indirectly by providing an arbitrary
+ notmuch query in <b>{}</b>. For example, the following returns threads
+ containing a message from mallory and one (not necessarily the
+ same message) with Subject containing the word "crypto".
+
+ % notmuch search 'thread:"{from:mallory}" and thread:"{subject:crypto}"'
+
+ The performance of such queries can vary wildly. To understand
+ this, the user should think of the query <b>thread:{<something>}</b> as
+ expanding to all of the thread IDs which match <b><something></b>; not‐
+ much then performs a second search using the expanded query.
+
<b>path:<directory-path></b> <b>or</b> <b>path:<directory-path>/**</b> <b>or</b> <b>path:/<regex>/</b>
The <b>path:</b> prefix searches for email messages that are in partic‐
- ular directories within the mail store. The directory must be
- specified relative to the top-level maildir (and without the
+ ular directories within the mail store. The directory must be
+ specified relative to the top-level maildir (and without the
leading slash). By default, <b>path:</b> matches messages in the speci‐
- fied directory only. The "/**" suffix can be used to match mes‐
- sages in the specified directory and all its subdirectories
- recursively. <b>path:""</b> matches messages in the root of the mail
+ fied directory only. The "/**" suffix can be used to match mes‐
+ sages in the specified directory and all its subdirectories
+ recursively. <b>path:""</b> matches messages in the root of the mail
store and, likewise, <b>path:**</b> matches all messages.
- <b>path:</b> will find a message if <u>any</u> copy of that message is in the
+ <b>path:</b> will find a message if <u>any</u> copy of that message is in the
specific directory.
<b>folder:<maildir-folder></b> <b>or</b> <b>folder:/<regex>/</b>
- The <b>folder:</b> prefix searches for email messages by maildir or MH
- folder. For MH-style folders, this is equivalent to <b>path:</b>. For
+ The <b>folder:</b> prefix searches for email messages by maildir or MH
+ folder. For MH-style folders, this is equivalent to <b>path:</b>. For
maildir, this includes messages in the "new" and "cur" subdirec‐
- tories. The exact syntax for maildir folders depends on your
- mail configuration. For maildir++, <b>folder:""</b> matches the inbox
- folder (which is the root in maildir++), other folder names
+ tories. The exact syntax for maildir folders depends on your
+ mail configuration. For maildir++, <b>folder:""</b> matches the inbox
+ folder (which is the root in maildir++), other folder names
always start with ".", and nested folders are separated by "."s,
such as <b>folder:.classes.topology</b>. For "file system" maildir, the
inbox is typically <b>folder:INBOX</b> and nested folders are separated
by slashes, such as <b>folder:classes/topology</b>.
- <b>folder:</b> will find a message if <u>any</u> copy of that message is in
+ <b>folder:</b> will find a message if <u>any</u> copy of that message is in
the specific folder.
<b>date:<since>..<until></b> <b>or</b> <b>date:<date></b>
- The <b>date:</b> prefix can be used to restrict the results to only
- messages within a particular time range (based on the Date:
+ The <b>date:</b> prefix can be used to restrict the results to only
+ messages within a particular time range (based on the Date:
header).
- See <b>DATE</b> <b>AND</b> <b>TIME</b> <b>SEARCH</b> below for details on the range expres‐
+ See <b>DATE</b> <b>AND</b> <b>TIME</b> <b>SEARCH</b> below for details on the range expres‐
sion, and supported syntax for <since> and <until> date and time
expressions.
- The time range can also be specified using timestamps with a
- syntax of:
+ The time range can also be specified using timestamps without
+ including the date prefix using a syntax of:
<initial-timestamp>..<final-timestamp>
- Each timestamp is a number representing the number of seconds
- since 1970-01-01 00:00:00 UTC.
+ Each timestamp is a number representing the number of seconds
+ since 1970-01-01 00:00:00 UTC. Specifying a time range this way
+ is considered legacy and predates the date prefix.
<b>lastmod:<initial-revision>..<final-revision></b>
The <b>lastmod:</b> prefix can be used to restrict the result by the
will not.
</pre>
+<h3> Quoting</h3>
+<pre>
+ Double quotes are also used by the notmuch query parser to protect
+ boolean terms, regular expressions, or subqueries containing spaces or
+ other special characters, e.g.
+
+ tag:"a tag"
+
+ folder:"/^.*/(Junk|Spam)$/"
+
+ thread:"{from:mallory and date:2009}"
+
+ As with phrases, you need to protect the double quotes from the shell
+ e.g.
+
+ % notmuch search 'folder:"/^.*/(Junk|Spam)$/"'
+ % notmuch search 'thread:"{from:mallory and date:2009}" and thread:{to:mallory}'
+</pre>
+
<h2>DATE AND TIME SEARCH</h2>
<pre>
- notmuch understands a variety of standard and natural ways of express‐
+ notmuch understands a variety of standard and natural ways of express‐
ing dates and times, both in absolute terms ("2012-10-24") and in rela‐
- tive terms ("yesterday"). Any number of relative terms can be combined
- ("1 hour 25 minutes") and an absolute date/time can be combined with
- relative terms to further adjust it. A non-exhaustive description of
+ tive terms ("yesterday"). Any number of relative terms can be combined
+ ("1 hour 25 minutes") and an absolute date/time can be combined with
+ relative terms to further adjust it. A non-exhaustive description of
the syntax supported for absolute and relative terms is given below.
</pre>
<pre>
date:<since>..<until>
- The above expression restricts the results to only messages from
+ The above expression restricts the results to only messages from
<since> to <until>, based on the Date: header.
- <since> and <until> can describe imprecise times, such as "yesterday".
- In this case, <since> is taken as the earliest time it could describe
+ <since> and <until> can describe imprecise times, such as "yesterday".
+ In this case, <since> is taken as the earliest time it could describe
(the beginning of yesterday) and <until> is taken as the latest time it
- could describe (the end of yesterday). Similarly, date:january..febru‐
+ could describe (the end of yesterday). Similarly, date:january..febru‐
ary matches from the beginning of January to the end of February.
+ If specifying a time range using timestamps in conjunction with the
+ date prefix, each timestamp must be preceded by @ (ASCII hex 40). As
+ above, each timestamp is a number representing the number of seconds
+ since 1970-01-01 00:00:00 UTC. For example:
+ date:@<initial-timestamp>..@<final-timestamp>
+
date:<expr>..! can be used as a shorthand for date:<expr>..<expr>. The
expansion takes place before interpretation, and thus, for example,
date:monday..! matches from the beginning of Monday until the end of
· named queries e.g. "query:my_special_query"
· regular expression searches, e.g. "subject:/^\[SPAM\]/"
+
+ · thread subqueries, e.g. "thread:{from:bob}"
</pre>
<h2>SEE ALSO</h2>
2009-2018, Carl Worth and many others
</pre>
-<h2>0.26</h2>
+<h2>0.27</h2>