]> git.notmuchmail.org Git - notmuch/blob - man/man1/notmuch-search.1
man: document notmuch search --duplicate=N
[notmuch] / man / man1 / notmuch-search.1
1 .TH NOTMUCH-SEARCH 1 2013-08-03 "Notmuch 0.16"
2 .SH NAME
3 notmuch-search \- search for messages matching the given search terms
4 .SH SYNOPSIS
5
6 .B notmuch search
7 .RI  [  options "...] <" search-term ">..."
8
9 .SH DESCRIPTION
10
11 Search for messages matching the given search terms, and display as
12 results the threads containing the matched messages.
13
14 The output consists of one line per thread, giving a thread ID, the
15 date of the newest (or oldest, depending on the sort option) matched
16 message in the thread, the number of matched messages and total
17 messages in the thread, the names of all participants in the thread,
18 and the subject of the newest (or oldest) message.
19
20 See \fBnotmuch-search-terms\fR(7)
21 for details of the supported syntax for <search-terms>.
22
23 Supported options for
24 .B search
25 include
26 .RS 4
27 .TP 4
28 .BR \-\-format= ( json | sexp | text | text0 )
29
30 Presents the results in either JSON, S-Expressions, newline character
31 separated plain-text (default), or null character separated plain-text
32 (compatible with \fBxargs\fR(1) -0 option where available).
33 .RE
34
35 .RS 4
36 .TP 4
37 .BR \-\-format-version=N
38
39 Use the specified structured output format version.  This is intended
40 for programs that invoke \fBnotmuch\fR(1) internally.  If omitted, the
41 latest supported version will be used.
42 .RE
43
44 .RS 4
45 .TP 4
46 .B \-\-output=(summary|threads|messages|files|tags)
47
48 .RS 4
49 .TP 4
50 .B summary
51
52 Output a summary of each thread with any message matching the search
53 terms. The summary includes the thread ID, date, the number of
54 messages in the thread (both the number matched and the total number),
55 the authors of the thread and the subject.
56 .RE
57 .RS 4
58 .TP 4
59 .B threads
60
61 Output the thread IDs of all threads with any message matching the
62 search terms, either one per line (\-\-format=text), separated by null
63 characters (\-\-format=text0), as a JSON array (\-\-format=json), or
64 an S-Expression list (\-\-format=sexp).
65 .RE
66 .RS 4
67 .TP 4
68 .B messages
69
70 Output the message IDs of all messages matching the search terms,
71 either one per line (\-\-format=text), separated by null characters
72 (\-\-format=text0), as a JSON array (\-\-format=json), or as an
73 S-Expression list (\-\-format=sexp).
74 .RE
75 .RS 4
76 .TP 4
77 .B files
78
79 Output the filenames of all messages matching the search terms, either
80 one per line (\-\-format=text), separated by null characters
81 (\-\-format=text0), as a JSON array (\-\-format=json), or as an
82 S-Expression list (\-\-format=sexp).
83
84 Note that each message may have multiple filenames associated with it.
85 All of them are included in the output, unless limited with the
86 \-\-duplicate=N option.
87 .RE
88 .RS 4
89 .TP 4
90 .B tags
91
92 Output all tags that appear on any message matching the search terms,
93 either one per line (\-\-format=text), separated by null characters
94 (\-\-format=text0), as a JSON array (\-\-format=json), or as an
95 S-Expression list (\-\-format=sexp).
96 .RE
97 .RE
98
99 .RS 4
100 .TP 4
101 .BR \-\-sort= ( newest\-first | oldest\-first )
102
103 This option can be used to present results in either chronological order
104 .RB ( oldest\-first )
105 or reverse chronological order
106 .RB ( newest\-first ).
107
108 Note: The thread order will be distinct between these two options
109 (beyond being simply reversed). When sorting by
110 .B oldest\-first
111 the threads will be sorted by the oldest message in each thread, but
112 when sorting by
113 .B newest\-first
114 the threads will be sorted by the newest message in each thread.
115
116 By default, results will be displayed in reverse chronological order,
117 (that is, the newest results will be displayed first).
118 .RE
119
120 .RS 4
121 .TP 4
122 .BR \-\-offset=[\-]N
123
124 Skip displaying the first N results. With the leading '\-', start at the Nth
125 result from the end.
126 .RE
127
128 .RS 4
129 .TP 4
130 .BR \-\-limit=N
131
132 Limit the number of displayed results to N.
133 .RE
134
135 .RS 4
136 .TP 4
137 .BR \-\-exclude=(true|false|all|flag)
138
139 A message is called "excluded" if it matches at least one tag in
140 search.tag_exclude that does not appear explicitly in the search terms.
141 This option specifies whether to omit excluded messages in the search
142 process.
143
144 The default value,
145 .BR true ,
146 prevents excluded messages from matching the search terms.
147
148 .B all
149 additionally prevents excluded messages from appearing in displayed
150 results, in effect behaving as though the excluded messages do not exist.
151
152 .B false
153 allows excluded messages to match search terms and appear in displayed
154 results. Excluded messages are still marked in the relevant outputs.
155
156 .B flag
157 only has an effect when
158 .BR --output=summary .
159 The output is almost identical to
160 .BR false ,
161 but the "match count" is the number of matching non-excluded messages in the
162 thread, rather than the number of matching messages.
163 .RE
164
165 .RS 4
166 .TP 4
167 .BR \-\-duplicate=N
168
169 Effective with
170 .BR --output=files ,
171 output the Nth filename associated with each message matching the
172 query (N is 1-based). If N is greater than the number of files
173 associated with the message, don't print anything.
174
175 Note that this option is orthogonal with the
176 .BR folder:
177 search prefix. The prefix matches messages based on filenames. This
178 option filters filenames of the matching messages.
179 .RE
180
181 .SH EXIT STATUS
182
183 This command supports the following special exit status codes
184
185 .TP
186 .B 20
187 The requested format version is too old.
188 .TP
189 .B 21
190 The requested format version is too new.
191
192 .SH SEE ALSO
193
194 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
195 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5),
196 \fBnotmuch-insert\fR(1), \fBnotmuch-new\fR(1),
197 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
198 \fBnotmuch-search-terms\fR(7), \fBnotmuch-show\fR(1),
199 \fBnotmuch-tag\fR(1)