From 6d2e4c8c8342279923a05ba72629f39039eaa3a1 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 16 Mar 2012 22:11:24 +2000 Subject: [PATCH] Re: [RFC] http://notmuchmail.org/searching/ [was: Re: Improving notmuch query documentation] --- 20/acdc6077a9776c17084f9b34dc79164e3331c8 | 205 ++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 20/acdc6077a9776c17084f9b34dc79164e3331c8 diff --git a/20/acdc6077a9776c17084f9b34dc79164e3331c8 b/20/acdc6077a9776c17084f9b34dc79164e3331c8 new file mode 100644 index 000000000..b9dc168b7 --- /dev/null +++ b/20/acdc6077a9776c17084f9b34dc79164e3331c8 @@ -0,0 +1,205 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AF5D1431FAF + for ; Thu, 15 Mar 2012 19:11:27 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 5xr+mJtBwveB for ; + Thu, 15 Mar 2012 19:11:27 -0700 (PDT) +Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU + [18.9.25.12]) + by olra.theworths.org (Postfix) with ESMTP id C585E431FAE + for ; Thu, 15 Mar 2012 19:11:26 -0700 (PDT) +X-AuditID: 1209190c-b7fad6d000000920-fc-4f62a14eb931 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id 3E.92.02336.E41A26F4; Thu, 15 Mar 2012 22:11:26 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q2G2BPvW031757; + Thu, 15 Mar 2012 22:11:26 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q2G2BOnR018316 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 15 Mar 2012 22:11:25 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1S8MdY-0001gz-4e; Thu, 15 Mar 2012 22:11:24 -0400 +Date: Thu, 15 Mar 2012 22:11:24 -0400 +From: Austin Clements +To: Andrei POPESCU +Subject: Re: [RFC] http://notmuchmail.org/searching/ [was: Re: Improving + notmuch query documentation] +Message-ID: <20120316021124.GD2670@mit.edu> +References: <20120115220600.GO7037@think.nuvreauspam> + <877h0sa207.fsf@fester.com> + <20120116202103.GA14329@think.nuvreauspam> + <20120117023431.GF16740@mit.edu> + <20120117221435.GN3272@think.nuvreauspam> + <20120117222923.GU16740@mit.edu> + <20120315093941.GK2981@sid.nuvreauspam> + <20120315211107.GA2670@mit.edu> + <20120316003053.GR2981@sid.nuvreauspam> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20120316003053.GR2981@sid.nuvreauspam> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixG6nouu3MMnf4M8VHotVE6Qtrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZdy5doS1YKJyxfLr85gbGLdJdzFyckgImEg8 + aLzOCGGLSVy4t56ti5GLQ0hgH6PE+ffzWCGcDYwSN88vhHJOMklMnPQEylnCKNH5ZhsTSD+L + gKrEykv/2UBsNgENiW37l4PNFRHQleh8dQCshllAWuLb72YwW1ggXeLZhmlgNbwC2hLXuhYx + Qwx9wSTx9dl5FoiEoMTJmU9YIJq1JG78ewnUzAE2aPk/DpAwJ9APO8//BdsrKqAiMeXkNrYJ + jEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl1DvdzMEr3UlNJNjKDA5pTk + 2cH45qDSIUYBDkYlHt5A3iR/IdbEsuLK3EOMkhxMSqK8vQuAQnxJ+SmVGYnFGfFFpTmpxYcY + JTiYlUR4MwwS/YV4UxIrq1KL8mFS0hwsSuK8Klrv/IQE0hNLUrNTUwtSi2CyMhwcShK8p0CG + ChalpqdWpGXmlCCkmTg4QYbzAA1fDVLDW1yQmFucmQ6RP8Woy9E99dElRiGWvPy8VClx3jUg + RQIgRRmleXBzYAnpFaM40FvCvNtAqniAyQxu0iugJUxAS0q+xYEsKUlESEk1MEa2v/DwCla9 + dLJ1xvndST8v3dry06j2luRFR6G5/d+mXu9fl7Hgkazn9wsRMlt7NkVdl5K+Z9uWp7en9o17 + xsv/asafma4l280//n1d8xV7qcv68YEsUuppv7zbzIQ9pewdJRvif/hbflz+UJjJ/m/b7/xr + eYWi8ioanJtm/JD479QSFuzVocRSnJFoqMVcVJwIAIUfaFkjAwAA +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 16 Mar 2012 02:11:27 -0000 + +Quoth Andrei POPESCU on Mar 16 at 2:30 am: +> On Jo, 15 mar 12, 17:11:08, Austin Clements wrote: +> > +> > I think having two divergent documents covering the same thing is less +> > than ideal, but perhaps they could be merged in the near future. +> +> I want to have this page more or less complete and descriptive. Once +> this is done I should be able to rewrite it more like a reference. +> +> Regarding 'notmuch help search-terms': +> +> $ notmuch help search-terms | wc -l +> 88 +> +> IMHO that text is better suited for a manpage, the help should be just a +> (very short) reference to refresh ones memory. What do you think? + +I'm not quite sure what you mean. That text is the man page. Though +it sounds like a great idea to have a quick syntax reference at the +top of the manpage so it's the first thing people see when they run +'notmuch help search-terms' (and they can still scroll down to get the +details if they want). + +> > A few comments: +> > +> > The section on "Languages other than English" isn't quite correct. +> > Xapian has no idea what language is being used, so it will still stem +> > terms in other languages, but using English stemming rules. +> +> Then I think it's safe to assume the results are very much dependent on +> the language, so if the language has some similarities to English Xapian +> might do some stemming. + +My point is that Xapian *will* do stemming, but using English stemming +rules, whether or not the language is English. Hence it's inaccurate +to say that text in other languages will be unstemmed. (Also, to be +fair to Xapian, it has stemmers for a whole bunch of languages; it's +notmuch that always configures it for English.) + +> > Notmuch doesn't use synonyms. +> +> Thanks. +> +> > It might be worth pointing out that "+term1" and "term1" are +> > equivalent. +> +> Yes. +> +> > "notmuch search -term2" doesn't actually work. I've never looked in +> > to why, but I've found that Xapian ignores '-' at the beginning of a +> > query or a parenthesized expression. +> +> Not sure what you mean here. Does Xapian just ignore the '-' and +> searches as if it wasn't specified? I'm usually testing stuff with + +I looked at this again and realized I was slightly wrong, so I had a +discussion with Olly and dug more in the code. At a high level, a +query is a bunch of "probs" combined with boolean operators and the +actual rule is that a prob consisting solely of a single '-' term is a +syntax error. And if a query has a syntax error, Xapian will re-parse +the entire query without any flags (which means no boolean operators, +love/hate, phrases, or wildcards). + +One upshot of this rule is that a standalone negation like +'-tag:inbox' will actually search for messages *with* tag:inbox (just +like searching for 'tag:inbox'): + +$ notmuch count -- -tag:inbox +650 +$ notmuch count -- tag:inbox +650 +$ notmuch count -- -tag:inbox x +9905 + +> 'notmuch count', but I get: +> +> $ notmuch count -Debian +> Unrecognized option: -Debian + +You need to tell count that it's not an option. The standard getopt +syntax for this works: + notmuch count -- -Debian + +> With 'search' I get results, but right now I can't think of a query to +> test. +> +> > "notmuch search term1 -term2" will work. +> +> Does 'notmuch search -term1 term2' work? + +'notmuch search -- -term1 term2' works. + +> > In the brackets section, you'll need shell escaping for those queries +> > to work. It might be worth pointing out the need for shell escaping +> > at the beginning. +> +> Right, anything other than brackets and '*'? + +Also double quotes. E.g., + notmuch search subject:"This may look like a phrase, but don't be fooled" +will search for messages with "this" in the subject and the words +"may", "look", "like", etc anywhere (and in any order). + +I think that's it for Xapian metacharacters, but of course things in +the query terms themselves could need shell escaping. Rather than try +to think about this, I generally put my whole query in single quotes +unless it's something obviously trivial that won't contain any shell +metacharacters. + +> > XOR, NEAR, and ADJ were intentionally undocumented in +> > notmuch-search-terms because they may go away some day and we don't +> > want people thinking they can depend on them. +> +> In such case I think it's better to state so. +> +> I'll integrate all your comments (if somebody else doesn't beat me to +> it). +> +> Kind regards, +> Andrei -- 2.26.2