]> git.notmuchmail.org Git - notmuch/blob - doc/man7/notmuch-search-terms.rst
man: update man pages for folder: and path: search terms
[notmuch] / doc / man7 / notmuch-search-terms.rst
1 ====================
2 notmuch-search-terms
3 ====================
4
5 SYNOPSIS
6 ========
7
8 **notmuch** **count** [option ...] <*search-term*> ...
9
10 **notmuch** **dump** [--format=(batch-tag|sup)] [--] [--output=<*file*>] [--] [<*search-term*> ...]
11
12 **notmuch** **search** [option ...] <*search-term*> ...
13
14 **notmuch** **show** [option ...] <*search-term*> ...
15
16 **notmuch** **tag** +<*tag*> ... -<*tag*> [--] <*search-term*> ...
17
18 DESCRIPTION
19 ===========
20
21 Several notmuch commands accept a common syntax for search terms.
22
23 The search terms can consist of free-form text (and quoted phrases)
24 which will match all messages that contain all of the given
25 terms/phrases in the body, the subject, or any of the sender or
26 recipient headers.
27
28 As a special case, a search string consisting of exactly a single
29 asterisk ("\*") will match all messages.
30
31 In addition to free text, the following prefixes can be used to force
32 terms to match against specific portions of an email, (where <brackets>
33 indicate user-supplied values):
34
35 -  from:<name-or-address>
36
37 -  to:<name-or-address>
38
39 -  subject:<word-or-quoted-phrase>
40
41 -  attachment:<word>
42
43 -  tag:<tag> (or is:<tag>)
44
45 -  id:<message-id>
46
47 -  thread:<thread-id>
48
49 -  folder:<maildir-folder>
50
51 -  path:<directory-path> or path:<directory-path>/**
52
53 -  date:<since>..<until>
54
55 The **from:** prefix is used to match the name or address of the sender
56 of an email message.
57
58 The **to:** prefix is used to match the names or addresses of any
59 recipient of an email message, (whether To, Cc, or Bcc).
60
61 Any term prefixed with **subject:** will match only text from the
62 subject of an email. Searching for a phrase in the subject is supported
63 by including quotation marks around the phrase, immediately following
64 **subject:**.
65
66 The **attachment:** prefix can be used to search for specific filenames
67 (or extensions) of attachments to email messages.
68
69 For **tag:** and **is:** valid tag values include **inbox** and
70 **unread** by default for new messages added by **notmuch new** as well
71 as any other tag values added manually with **notmuch tag**.
72
73 For **id:**, message ID values are the literal contents of the
74 Message-ID: header of email messages, but without the '<', '>'
75 delimiters.
76
77 The **thread:** prefix can be used with the thread ID values that are
78 generated internally by notmuch (and do not appear in email messages).
79 These thread ID values can be seen in the first column of output from
80 **notmuch search**
81
82 The **path:** prefix searches for email messages that are in
83 particular directories within the mail store. The directory must be
84 specified relative to the top-level maildir (and without the leading
85 slash). By default, **path:** matches messages in the specified
86 directory only. The "/\*\*" suffix can be used to match messages in
87 the specified directory and all its subdirectories recursively.
88 **path:""** matches messages in the root of the mail store and,
89 likewise, **path:\*\*** matches all messages.
90
91 The **folder:** prefix searches for email messages by maildir or MH
92 folder. For MH-style folders, this is equivalent to **path:**. For
93 maildir, this includes messages in the "new" and "cur"
94 subdirectories. The exact syntax for maildir folders depends on your
95 mail configuration. For maildir++, **folder:""** matches the inbox
96 folder (which is the root in maildir++), other folder names always
97 start with ".", and nested folders are separated by "."s, such as
98 **folder:.classes.topology**. For "file system" maildir, the inbox is
99 typically **folder:INBOX** and nested folders are separated by
100 slashes, such as **folder:classes/topology**.
101
102 Both **path:** and **folder:** will find a message if *any* copy of
103 that message is in the specific directory/folder.
104
105 The **date:** prefix can be used to restrict the results to only
106 messages within a particular time range (based on the Date: header) with
107 a range syntax of:
108
109 date:<since>..<until>
110
111 See **DATE AND TIME SEARCH** below for details on the range expression,
112 and supported syntax for <since> and <until> date and time expressions.
113
114 The time range can also be specified using timestamps with a syntax of:
115
116 <initial-timestamp>..<final-timestamp>
117
118 Each timestamp is a number representing the number of seconds since
119 1970-01-01 00:00:00 UTC.
120
121 In addition to individual terms, multiple terms can be combined with
122 Boolean operators ( **and**, **or**, **not** , etc.). Each term in the
123 query will be implicitly connected by a logical AND if no explicit
124 operator is provided, (except that terms with a common prefix will be
125 implicitly combined with OR until we get Xapian defect #402 fixed).
126
127 Parentheses can also be used to control the combination of the Boolean
128 operators, but will have to be protected from interpretation by the
129 shell, (such as by putting quotation marks around any parenthesized
130 expression).
131
132 DATE AND TIME SEARCH
133 ====================
134
135 notmuch understands a variety of standard and natural ways of expressing
136 dates and times, both in absolute terms ("2012-10-24") and in relative
137 terms ("yesterday"). Any number of relative terms can be combined ("1
138 hour 25 minutes") and an absolute date/time can be combined with
139 relative terms to further adjust it. A non-exhaustive description of the
140 syntax supported for absolute and relative terms is given below.
141
142 The range expression
143 --------------------
144
145 date:<since>..<until>
146
147 The above expression restricts the results to only messages from <since>
148 to <until>, based on the Date: header.
149
150 <since> and <until> can describe imprecise times, such as "yesterday".
151 In this case, <since> is taken as the earliest time it could describe
152 (the beginning of yesterday) and <until> is taken as the latest time it
153 could describe (the end of yesterday). Similarly, date:january..february
154 matches from the beginning of January to the end of February.
155
156 Currently, we do not support spaces in range expressions. You can
157 replace the spaces with '\_', or (in most cases) '-', or (in some cases)
158 leave the spaces out altogether. Examples in this man page use spaces
159 for clarity.
160
161 Open-ended ranges are supported (since Xapian 1.2.1), i.e. it's possible
162 to specify date:..<until> or date:<since>.. to not limit the start or
163 end time, respectively. Pre-1.2.1 Xapian does not report an error on
164 open ended ranges, but it does not work as expected either.
165
166 Entering date:expr without ".." (for example date:yesterday) won't work,
167 as it's not interpreted as a range expression at all. You can achieve
168 the expected result by duplicating the expr both sides of ".." (for
169 example date:yesterday..yesterday).
170
171 Relative date and time
172 ----------------------
173
174 [N\|number]
175 (years\|months\|weeks\|days\|hours\|hrs\|minutes\|mins\|seconds\|secs)
176 [...]
177
178 All refer to past, can be repeated and will be accumulated.
179
180 Units can be abbreviated to any length, with the otherwise ambiguous
181 single m being m for minutes and M for months.
182
183 Number can also be written out one, two, ..., ten, dozen, hundred.
184 Additionally, the unit may be preceded by "last" or "this" (e.g., "last
185 week" or "this month").
186
187 When combined with absolute date and time, the relative date and time
188 specification will be relative from the specified absolute date and
189 time.
190
191 Examples: 5M2d, two weeks
192
193 Supported absolute time formats
194 -------------------------------
195
196 -  H[H]:MM[:SS] [(am\|a.m.\|pm\|p.m.)]
197
198 -  H[H] (am\|a.m.\|pm\|p.m.)
199
200 -  HHMMSS
201
202 -  now
203
204 -  noon
205
206 -  midnight
207
208 -  Examples: 17:05, 5pm
209
210 Supported absolute date formats
211 -------------------------------
212
213 -  YYYY-MM[-DD]
214
215 -  DD-MM[-[YY]YY]
216
217 -  MM-YYYY
218
219 -  M[M]/D[D][/[YY]YY]
220
221 -  M[M]/YYYY
222
223 -  D[D].M[M][.[YY]YY]
224
225 -  D[D][(st\|nd\|rd\|th)] Mon[thname] [YYYY]
226
227 -  Mon[thname] D[D][(st\|nd\|rd\|th)] [YYYY]
228
229 -  Wee[kday]
230
231 Month names can be abbreviated at three or more characters.
232
233 Weekday names can be abbreviated at three or more characters.
234
235 Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3
236
237 Time zones
238 ----------
239
240 -  (+\|-)HH:MM
241
242 -  (+\|-)HH[MM]
243
244 Some time zone codes, e.g. UTC, EET.
245
246 SEE ALSO
247 ========
248
249 **notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,
250 **notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,
251 **notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,
252 **notmuch-search(1)**, **notmuch-show(1)**, **notmuch-tag(1)**