]> git.cworth.org Git - notmuch-wiki/blob - manpages/notmuch-search-terms-7.mdwn
manpages/ for quality control. manpages.mdwn todo
[notmuch-wiki] / manpages / notmuch-search-terms-7.mdwn
1 <h1>NOTMUCH-SEARCH-TERMS(7)</h1>
2
3 <h2>NAME</h2>
4
5 <pre>
6        notmuch-search-terms - Syntax for notmuch queries
7 </pre>
8
9 <h2>SYNOPSIS</h2>
10
11 <pre>
12        <b>notmuch</b> <b>count</b> [<u>options...</u>]  <<u>search-term</u>>...
13 </pre>
14
15 <pre>
16        <b>notmuch</b> <b>dump</b> [ <<u>filename</u>> ] [--] [ <<u>search-term</u>>...]
17 </pre>
18
19 <pre>
20        <b>notmuch</b> <b>search</b> [<u>options</u>...] <<u>search-term</u>>...
21 </pre>
22
23 <pre>
24        <b>notmuch</b> <b>show</b> [<u>options</u>...] <<u>search-term</u>>...
25 </pre>
26
27 <pre>
28        <b>notmuch</b> <b>tag</b> +<<u>tag></u>|-<<u>tag</u>> [...] [--] <<u>search-term</u>>...
29 </pre>
30
31 <h2>DESCRIPTION</h2>
32
33 <pre>
34        Several notmuch commands accept a common syntax for search terms.
35 </pre>
36
37 <pre>
38        The  search  terms  can  consist of free-form text (and quoted phrases)
39        which  will  match  all  messages  that  contain  all  of   the   given
40        terms/phrases in the body, the subject, or any of the sender or recipi-
41        ent headers.
42 </pre>
43
44 <pre>
45        As a special case, a search  string  consisting  of  exactly  a  single
46        asterisk ("*") will match all messages.
47 </pre>
48
49 <pre>
50        In  addition  to free text, the following prefixes can be used to force
51        terms to match against specific portions of an email, (where <brackets>
52        indicate user-supplied values):
53 </pre>
54
55 <pre>
56             from:<name-or-address>
57 </pre>
58
59 <pre>
60             to:<name-or-address>
61 </pre>
62
63 <pre>
64             subject:<word-or-quoted-phrase>
65 </pre>
66
67 <pre>
68             attachment:<word>
69 </pre>
70
71 <pre>
72             tag:<tag> (or is:<tag>)
73 </pre>
74
75 <pre>
76             id:<message-id>
77 </pre>
78
79 <pre>
80             thread:<thread-id>
81 </pre>
82
83 <pre>
84             folder:<directory-path>
85 </pre>
86
87 <pre>
88        The  <b>from:</b> prefix is used to match the name or address of the sender of
89        an email message.
90 </pre>
91
92 <pre>
93        The <b>to:</b> prefix is used to match the names or addresses of any recipient
94        of an email message, (whether To, Cc, or Bcc).
95 </pre>
96
97 <pre>
98        Any  term  prefixed with <b>subject:</b> will match only text from the subject
99        of an email. Searching for a phrase in  the  subject  is  supported  by
100        including quotation marks around the phrase, immediately following <b>sub-</b>
101        <b>ject:</b>.
102 </pre>
103
104 <pre>
105        The <b>attachment:</b> prefix can be used to search for specific filenames (or
106        extensions) of attachments to email messages.
107 </pre>
108
109 <pre>
110        For  <b>tag:</b>  and <b>is:</b> valid tag values include <b>inbox</b> and <b>unread</b> by default
111        for new messages added by <b>notmuch</b> <b>new</b> as well as any other  tag  values
112        added manually with <b>notmuch</b> <b>tag</b>.
113 </pre>
114
115 <pre>
116        For  <b>id:</b>, message ID values are the literal contents of the Message-ID:
117        header of email messages, but without the '<', '>' delimiters.
118 </pre>
119
120 <pre>
121        The <b>thread:</b> prefix can be used with the thread ID values that are  gen-
122        erated  internally  by  notmuch  (and do not appear in email messages).
123        These thread ID values can be seen in the first column of  output  from
124        <b>notmuch</b> <b>search</b>
125 </pre>
126
127 <pre>
128        The  <b>folder:</b>  prefix can be used to search for email message files that
129        are contained within particular directories within the mail store. Only
130        the  directory  components  below  the top-level mail database path are
131        available to be searched.
132 </pre>
133
134 <pre>
135        In addition to individual terms, multiple terms can  be  combined  with
136        Boolean  operators  ( <b>and</b>, <b>or</b>, <b>not</b> , etc.). Each term in the query will
137        be implicitly connected by a logical AND if  no  explicit  operator  is
138        provided,  (except  that  terms with a common prefix will be implicitly
139        combined with OR until we get Xapian defect #402 fixed).
140 </pre>
141
142 <pre>
143        Parentheses can also be used to control the combination of the  Boolean
144        operators,  but  will  have  to be protected from interpretation by the
145        shell, (such as by putting quotation  marks  around  any  parenthesized
146        expression).
147 </pre>
148
149 <pre>
150        Finally, results can be restricted to only messages within a particular
151        time range, (based on the Date: header) with a syntax of:
152 </pre>
153
154 <pre>
155             <initial-timestamp>..<final-timestamp>
156 </pre>
157
158 <pre>
159        Each timestamp is a number representing the  number  of  seconds  since
160        1970-01-01  00:00:00  UTC.  This  is  not  the most convenient means of
161        expressing date ranges, but until notmuch is fixed  to  accept  a  more
162        convenient  form, one can use the date program to construct timestamps.
163        For example, with the bash shell the following syntax would  specify  a
164        date range to return messages from 2009-10-01 until the current time:
165 </pre>
166
167 <pre>
168             $(date +%s -d 2009-10-01)..$(date +%s)
169 </pre>
170
171 <h2>SEE ALSO</h2>
172
173 <pre>
174        <b>notmuch</b>(1),  <b>notmuch-config</b>(1), <b>notmuch-count</b>(1), <b>notmuch-dump</b>(1), <b>not-</b>
175        <b>much-hooks</b>(5),  <b>notmuch-new</b>(1),  <b>notmuch-reply</b>(1),  <b>notmuch-restore</b>(1),
176        <b>notmuch-search</b>(1), <b>notmuch-show</b>(1), <b>notmuch-tag</b>(1)
177 </pre>
178
179 <h1>Notmuch 0.13.2</h1>