]> git.notmuchmail.org Git - notmuch/blob - man/man1/notmuch-search.1
man: clarify search --exclude=flag
[notmuch] / man / man1 / notmuch-search.1
1 .TH NOTMUCH-SEARCH 1 2013-02-17 "Notmuch 0.15.2"
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 .RE
84 .RS 4
85 .TP 4
86 .B tags
87
88 Output all tags that appear on any message matching the search terms,
89 either one per line (\-\-format=text), separated by null characters
90 (\-\-format=text0), as a JSON array (\-\-format=json), or as an
91 S-Expression list (\-\-format=sexp).
92 .RE
93 .RE
94
95 .RS 4
96 .TP 4
97 .BR \-\-sort= ( newest\-first | oldest\-first )
98
99 This option can be used to present results in either chronological order
100 .RB ( oldest\-first )
101 or reverse chronological order
102 .RB ( newest\-first ).
103
104 Note: The thread order will be distinct between these two options
105 (beyond being simply reversed). When sorting by
106 .B oldest\-first
107 the threads will be sorted by the oldest message in each thread, but
108 when sorting by
109 .B newest\-first
110 the threads will be sorted by the newest message in each thread.
111
112 By default, results will be displayed in reverse chronological order,
113 (that is, the newest results will be displayed first).
114 .RE
115
116 .RS 4
117 .TP 4
118 .BR \-\-offset=[\-]N
119
120 Skip displaying the first N results. With the leading '\-', start at the Nth
121 result from the end.
122 .RE
123
124 .RS 4
125 .TP 4
126 .BR \-\-limit=N
127
128 Limit the number of displayed results to N.
129 .RE
130
131 .RS 4
132 .TP 4
133 .BR \-\-exclude=(true|false|flag)
134
135 A message is called "excluded" if it matches at least one tag in
136 search.tag_exclude that does not appear explicitly in the search terms.
137 This option specifies whether to omit excluded messages in the search
138 process.
139
140 The default value,
141 .BR true ,
142 prevents excluded messages from matching the search terms.
143
144 .B false
145 allows excluded messages to match search terms and appear in displayed
146 results. Excluded messages are still marked in the relevant outputs.
147
148 .B flag
149 only has an effect when
150 .BR --output=summary .
151 The output is almost identical to
152 .BR false ,
153 but the "match count" is the number of matching non-excluded messages in the
154 thread, rather than the number of matching messages.
155 .RE
156
157 .SH EXIT STATUS
158
159 This command supports the following special exit status codes
160
161 .TP
162 .B 20
163 The requested format version is too old.
164 .TP
165 .B 21
166 The requested format version is too new.
167
168 .SH SEE ALSO
169
170 \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),
171 \fBnotmuch-dump\fR(1), \fBnotmuch-hooks\fR(5), \fBnotmuch-new\fR(1),
172 \fBnotmuch-reply\fR(1), \fBnotmuch-restore\fR(1),
173 \fBnotmuch-search-terms\fR(7), \fBnotmuch-show\fR(1),
174 \fBnotmuch-tag\fR(1)