]> git.notmuchmail.org Git - notmuch/blob - man/man7/notmuch-search-terms.7
version: bump version
[notmuch] / man / man7 / notmuch-search-terms.7
1 .TH NOTMUCH-SEARCH-TERMS 7 2013-12-07 "Notmuch 0.17~rc3"
2
3 .SH NAME
4 notmuch-search-terms \- syntax for notmuch queries
5
6 .SH SYNOPSIS
7
8 .B notmuch count
9 .RI  [ options... ]
10 .RI  < search-term ">..."
11
12 .B "notmuch dump"
13 .RI "[ <" filename "> ] [--]"
14 .RI "[ <" search-term ">...]"
15
16 .B notmuch search
17 .RI  [  options "...] <" search-term ">..."
18
19 .B notmuch show
20 .RI "[" options "...] <" search-term ">..."
21
22 .B notmuch tag
23 .RI  "+<" tag> "|\-<" tag "> [...] [\-\-] <" search-term ">..."
24
25
26 .SH DESCRIPTION
27 Several notmuch commands accept a common syntax for search terms.
28
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
32 recipient headers.
33
34 As a special case, a search string consisting of exactly a single
35 asterisk ("*") will match all messages.
36
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):
40
41         from:<name-or-address>
42
43         to:<name-or-address>
44
45         subject:<word-or-quoted-phrase>
46
47         attachment:<word>
48
49         tag:<tag> (or is:<tag>)
50
51         id:<message-id>
52
53         thread:<thread-id>
54
55         folder:<directory-path>
56
57         date:<since>..<until>
58
59 The
60 .B from:
61 prefix is used to match the name or address of the sender of an email
62 message.
63
64 The
65 .B to:
66 prefix is used to match the names or addresses of any recipient of an
67 email message, (whether To, Cc, or Bcc).
68
69 Any term prefixed with
70 .B subject:
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
74 .BR subject: .
75
76 The
77 .B attachment:
78 prefix can be used to search for specific filenames (or extensions) of
79 attachments to email messages.
80
81 For
82 .BR tag: " and " is:
83 valid tag values include
84 .BR inbox " and " unread
85 by default for new messages added by
86 .B notmuch new
87 as well as any other tag values added manually with
88 .BR "notmuch tag" .
89
90 For
91 .BR id: ,
92 message ID values are the literal contents of the Message\-ID: header
93 of email messages, but without the '<', '>' delimiters.
94
95 The
96 .B thread:
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
100 .B "notmuch search"
101
102 The
103 .B folder:
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.
110
111 The
112 .B date:
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
115 of:
116
117         date:<since>..<until>
118
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
121 expressions.
122
123 The time range can also be specified using timestamps with a syntax
124 of:
125
126         <initial-timestamp>..<final-timestamp>
127
128 Each timestamp is a number representing the number of seconds since
129 1970\-01\-01 00:00:00 UTC.
130
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).
138
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
142 expression).
143
144 .SH DATE AND TIME SEARCH
145
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
152 given below.
153
154 .RS 4
155 .TP 4
156 .B The range expression
157
158 date:<since>..<until>
159
160 The above expression restricts the results to only messages from
161 <since> to <until>, based on the Date: header.
162
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
168 end of February.
169
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
173 spaces for clarity.
174
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.
179
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).
184 .RE
185
186 .RS 4
187 .TP 4
188 .B Relative date and time
189 [N|number] (years|months|weeks|days|hours|hrs|minutes|mins|seconds|secs) [...]
190
191 All refer to past, can be repeated and will be accumulated.
192
193 Units can be abbreviated to any length, with the otherwise ambiguous
194 single m being m for minutes and M for months.
195
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").
199
200 When combined with absolute date and time, the relative date and time
201 specification will be relative from the specified absolute date and
202 time.
203
204 Examples: 5M2d, two weeks
205 .RE
206
207 .RS 4
208 .TP 4
209 .B Supported absolute time formats
210 H[H]:MM[:SS] [(am|a.m.|pm|p.m.)]
211
212 H[H] (am|a.m.|pm|p.m.)
213
214 HHMMSS
215
216 now
217
218 noon
219
220 midnight
221
222 Examples: 17:05, 5pm
223 .RE
224
225 .RS 4
226 .TP 4
227 .B Supported absolute date formats
228 YYYY-MM[-DD]
229
230 DD-MM[-[YY]YY]
231
232 MM-YYYY
233
234 M[M]/D[D][/[YY]YY]
235
236 M[M]/YYYY
237
238 D[D].M[M][.[YY]YY]
239
240 D[D][(st|nd|rd|th)] Mon[thname] [YYYY]
241
242 Mon[thname] D[D][(st|nd|rd|th)] [YYYY]
243
244 Wee[kday]
245
246 Month names can be abbreviated at three or more characters.
247
248 Weekday names can be abbreviated at three or more characters.
249
250 Examples: 2012-07-31, 31-07-2012, 7/31/2012, August 3
251 .RE
252
253 .RS 4
254 .TP 4
255 .B Time zones
256 (+|-)HH:MM
257
258 (+|-)HH[MM]
259
260 Some time zone codes, e.g. UTC, EET.
261 .RE
262
263 .SH SEE ALSO
264
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)