[PATCH v3 1/4] cli: add global option --stderr=FILE
[notmuch-archives.git] / 20 / acdc6077a9776c17084f9b34dc79164e3331c8
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id AF5D1431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 19:11:27 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 5xr+mJtBwveB for <notmuch@notmuchmail.org>;\r
16         Thu, 15 Mar 2012 19:11:27 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id C585E431FAE\r
20         for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 19:11:26 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7fad6d000000920-fc-4f62a14eb931\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 3E.92.02336.E41A26F4; Thu, 15 Mar 2012 22:11:26 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q2G2BPvW031757; \r
27         Thu, 15 Mar 2012 22:11:26 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q2G2BOnR018316\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Thu, 15 Mar 2012 22:11:25 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1S8MdY-0001gz-4e; Thu, 15 Mar 2012 22:11:24 -0400\r
37 Date: Thu, 15 Mar 2012 22:11:24 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Andrei POPESCU <andreimpopescu@gmail.com>\r
40 Subject: Re: [RFC] http://notmuchmail.org/searching/ [was: Re: Improving\r
41         notmuch query documentation]\r
42 Message-ID: <20120316021124.GD2670@mit.edu>\r
43 References: <20120115220600.GO7037@think.nuvreauspam>\r
44         <877h0sa207.fsf@fester.com>\r
45         <20120116202103.GA14329@think.nuvreauspam>\r
46         <20120117023431.GF16740@mit.edu>\r
47         <20120117221435.GN3272@think.nuvreauspam>\r
48         <20120117222923.GU16740@mit.edu>\r
49         <20120315093941.GK2981@sid.nuvreauspam>\r
50         <20120315211107.GA2670@mit.edu>\r
51         <20120316003053.GR2981@sid.nuvreauspam>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=us-ascii\r
54 Content-Disposition: inline\r
55 In-Reply-To: <20120316003053.GR2981@sid.nuvreauspam>\r
56 User-Agent: Mutt/1.5.21 (2010-09-15)\r
57 X-Brightmail-Tracker:\r
58  H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixG6nouu3MMnf4M8VHotVE6Qtrt+cyezA\r
59         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZdy5doS1YKJyxfLr85gbGLdJdzFyckgImEg8\r
60         aLzOCGGLSVy4t56ti5GLQ0hgH6PE+ffzWCGcDYwSN88vhHJOMklMnPQEylnCKNH5ZhsTSD+L\r
61         gKrEykv/2UBsNgENiW37l4PNFRHQleh8dQCshllAWuLb72YwW1ggXeLZhmlgNbwC2hLXuhYx\r
62         Qwx9wSTx9dl5FoiEoMTJmU9YIJq1JG78ewnUzAE2aPk/DpAwJ9APO8//BdsrKqAiMeXkNrYJ\r
63         jEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl1DvdzMEr3UlNJNjKDA5pTk\r
64         2cH45qDSIUYBDkYlHt5A3iR/IdbEsuLK3EOMkhxMSqK8vQuAQnxJ+SmVGYnFGfFFpTmpxYcY\r
65         JTiYlUR4MwwS/YV4UxIrq1KL8mFS0hwsSuK8Klrv/IQE0hNLUrNTUwtSi2CyMhwcShK8p0CG\r
66         ChalpqdWpGXmlCCkmTg4QYbzAA1fDVLDW1yQmFucmQ6RP8Woy9E99dElRiGWvPy8VClx3jUg\r
67         RQIgRRmleXBzYAnpFaM40FvCvNtAqniAyQxu0iugJUxAS0q+xYEsKUlESEk1MEa2v/DwCla9\r
68         dLJ1xvndST8v3dry06j2luRFR6G5/d+mXu9fl7Hgkazn9wsRMlt7NkVdl5K+Z9uWp7en9o17\r
69         xsv/asafma4l280//n1d8xV7qcv68YEsUuppv7zbzIQ9pewdJRvif/hbflz+UJjJ/m/b7/xr\r
70         eYWi8ioanJtm/JD479QSFuzVocRSnJFoqMVcVJwIAIUfaFkjAwAA\r
71 Cc: notmuch@notmuchmail.org\r
72 X-BeenThere: notmuch@notmuchmail.org\r
73 X-Mailman-Version: 2.1.13\r
74 Precedence: list\r
75 List-Id: "Use and development of the notmuch mail system."\r
76         <notmuch.notmuchmail.org>\r
77 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
79 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
80 List-Post: <mailto:notmuch@notmuchmail.org>\r
81 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
82 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
83         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
84 X-List-Received-Date: Fri, 16 Mar 2012 02:11:27 -0000\r
85 \r
86 Quoth Andrei POPESCU on Mar 16 at  2:30 am:\r
87 > On Jo, 15 mar 12, 17:11:08, Austin Clements wrote:\r
88 > > \r
89 > > I think having two divergent documents covering the same thing is less\r
90 > > than ideal, but perhaps they could be merged in the near future.\r
91\r
92 > I want to have this page more or less complete and descriptive. Once \r
93 > this is done I should be able to rewrite it more like a reference.\r
94\r
95 > Regarding 'notmuch help search-terms':\r
96\r
97 > $ notmuch help search-terms | wc -l\r
98 > 88\r
99\r
100 > IMHO that text is better suited for a manpage, the help should be just a \r
101 > (very short) reference to refresh ones memory. What do you think?\r
102 \r
103 I'm not quite sure what you mean.  That text is the man page.  Though\r
104 it sounds like a great idea to have a quick syntax reference at the\r
105 top of the manpage so it's the first thing people see when they run\r
106 'notmuch help search-terms' (and they can still scroll down to get the\r
107 details if they want).\r
108 \r
109 > > A few comments:\r
110 > > \r
111 > > The section on "Languages other than English" isn't quite correct.\r
112 > > Xapian has no idea what language is being used, so it will still stem\r
113 > > terms in other languages, but using English stemming rules.\r
114\r
115 > Then I think it's safe to assume the results are very much dependent on \r
116 > the language, so if the language has some similarities to English Xapian \r
117 > might do some stemming.\r
118 \r
119 My point is that Xapian *will* do stemming, but using English stemming\r
120 rules, whether or not the language is English.  Hence it's inaccurate\r
121 to say that text in other languages will be unstemmed.  (Also, to be\r
122 fair to Xapian, it has stemmers for a whole bunch of languages; it's\r
123 notmuch that always configures it for English.)\r
124 \r
125 > > Notmuch doesn't use synonyms.\r
126\r
127 > Thanks.\r
128\r
129 > > It might be worth pointing out that "+term1" and "term1" are\r
130 > > equivalent.\r
131\r
132 > Yes.\r
133\r
134 > > "notmuch search -term2" doesn't actually work.  I've never looked in\r
135 > > to why, but I've found that Xapian ignores '-' at the beginning of a\r
136 > > query or a parenthesized expression.\r
137\r
138 > Not sure what you mean here. Does Xapian just ignore the '-' and \r
139 > searches as if it wasn't specified? I'm usually testing stuff with \r
140 \r
141 I looked at this again and realized I was slightly wrong, so I had a\r
142 discussion with Olly and dug more in the code.  At a high level, a\r
143 query is a bunch of "probs" combined with boolean operators and the\r
144 actual rule is that a prob consisting solely of a single '-' term is a\r
145 syntax error.  And if a query has a syntax error, Xapian will re-parse\r
146 the entire query without any flags (which means no boolean operators,\r
147 love/hate, phrases, or wildcards).\r
148 \r
149 One upshot of this rule is that a standalone negation like\r
150 '-tag:inbox' will actually search for messages *with* tag:inbox (just\r
151 like searching for 'tag:inbox'):\r
152 \r
153 $ notmuch count -- -tag:inbox\r
154 650\r
155 $ notmuch count -- tag:inbox\r
156 650\r
157 $ notmuch count -- -tag:inbox x\r
158 9905\r
159 \r
160 > 'notmuch count', but I get:\r
161\r
162 > $ notmuch count -Debian\r
163 > Unrecognized option: -Debian\r
164 \r
165 You need to tell count that it's not an option.  The standard getopt\r
166 syntax for this works:\r
167   notmuch count -- -Debian\r
168 \r
169 > With 'search' I get results, but right now I can't think of a query to \r
170 > test.\r
171\r
172 > > "notmuch search term1 -term2" will work.\r
173\r
174 > Does 'notmuch search -term1 term2' work?\r
175 \r
176 'notmuch search -- -term1 term2' works.\r
177 \r
178 > > In the brackets section, you'll need shell escaping for those queries\r
179 > > to work.  It might be worth pointing out the need for shell escaping\r
180 > > at the beginning.\r
181\r
182 > Right, anything other than brackets and '*'?\r
183 \r
184 Also double quotes.  E.g.,\r
185   notmuch search subject:"This may look like a phrase, but don't be fooled"\r
186 will search for messages with "this" in the subject and the words\r
187 "may", "look", "like", etc anywhere (and in any order).\r
188 \r
189 I think that's it for Xapian metacharacters, but of course things in\r
190 the query terms themselves could need shell escaping.  Rather than try\r
191 to think about this, I generally put my whole query in single quotes\r
192 unless it's something obviously trivial that won't contain any shell\r
193 metacharacters.\r
194 \r
195 > > XOR, NEAR, and ADJ were intentionally undocumented in\r
196 > > notmuch-search-terms because they may go away some day and we don't\r
197 > > want people thinking they can depend on them.\r
198\r
199 > In such case I think it's better to state so.\r
200\r
201 > I'll integrate all your comments (if somebody else doesn't beat me to \r
202 > it).\r
203\r
204 > Kind regards,\r
205 > Andrei\r