]> git.notmuchmail.org Git - notmuch/blob - man/man7/notmuch-search-terms.7
bump version to 0.13~rc1
[notmuch] / man / man7 / notmuch-search-terms.7
1 .TH NOTMUCH-SEARCH-TERMS 7 2012-05-08 "Notmuch 0.13~rc1"
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 The
58 .B from:
59 prefix is used to match the name or address of the sender of an email
60 message.
61
62 The
63 .B to:
64 prefix is used to match the names or addresses of any recipient of an
65 email message, (whether To, Cc, or Bcc).
66
67 Any term prefixed with
68 .B subject:
69 will match only text from the subject of an email. Searching for a
70 phrase in the subject is supported by including quotation marks around
71 the phrase, immediately following
72 .BR subject: .
73
74 The
75 .B attachment:
76 prefix can be used to search for specific filenames (or extensions) of
77 attachments to email messages.
78
79 For
80 .BR tag: " and " is:
81 valid tag values include
82 .BR inbox " and " unread
83 by default for new messages added by
84 .B notmuch new
85 as well as any other tag values added manually with
86 .BR "notmuch tag" .
87
88 For
89 .BR id: ,
90 message ID values are the literal contents of the Message\-ID: header
91 of email messages, but without the '<', '>' delimiters.
92
93 The
94 .B thread:
95 prefix can be used with the thread ID values that are generated
96 internally by notmuch (and do not appear in email messages). These
97 thread ID values can be seen in the first column of output from
98 .B "notmuch search"
99
100 The
101 .B folder:
102 prefix can be used to search for email message files that are
103 contained within particular directories within the mail store. Only
104 the directory components below the top-level mail database path are
105 available to be searched.
106
107 In addition to individual terms, multiple terms can be
108 combined with Boolean operators (
109 .BR and ", " or ", " not
110 , etc.). Each term in the query will be implicitly connected by a
111 logical AND if no explicit operator is provided, (except that terms
112 with a common prefix will be implicitly combined with OR until we get
113 Xapian defect #402 fixed).
114
115 Parentheses can also be used to control the combination of the Boolean
116 operators, but will have to be protected from interpretation by the
117 shell, (such as by putting quotation marks around any parenthesized
118 expression).
119
120 Finally, results can be restricted to only messages within a
121 particular time range, (based on the Date: header) with a syntax of:
122
123         <initial-timestamp>..<final-timestamp>
124
125 Each timestamp is a number representing the number of seconds since
126 1970\-01\-01 00:00:00 UTC. This is not the most convenient means of
127 expressing date ranges, but until notmuch is fixed to accept a more
128 convenient form, one can use the date program to construct
129 timestamps. For example, with the bash shell the following syntax would
130 specify a date range to return messages from 2009\-10\-01 until the
131 current time:
132
133         $(date +%s \-d 2009\-10\-01)..$(date +%s)
134
135 .SH SEE ALSO
136
137 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
138 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5), \fBnotmuch-new\fR(1),
139 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
140 \fBnotmuch-search\fR(1), \fBnotmuch-show\fR(1), \fBnotmuch-tag\fR(1)