[notmuch] [PATCH] Allow lone "not" search operators
authorAdrian Perez <aperez@igalia.com>
Thu, 19 Nov 2009 00:07:22 +0000 (01:07 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:36 +0000 (09:35 -0800)
19/92ff4ec9eaabb6abd4bb669e805a999b013134 [new file with mode: 0644]

diff --git a/19/92ff4ec9eaabb6abd4bb669e805a999b013134 b/19/92ff4ec9eaabb6abd4bb669e805a999b013134
new file mode 100644 (file)
index 0000000..f02075d
--- /dev/null
@@ -0,0 +1,77 @@
+Return-Path: <aperez@hikari.localdomain>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 11FAC431FBF\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 16:08:48 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id r9eENtqtINSZ for <notmuch@notmuchmail.org>;\r
+       Wed, 18 Nov 2009 16:08:46 -0800 (PST)\r
+Received: from alice.connectical.com (alice.connectical.com [208.89.208.235])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4BC42431FBC\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 16:08:46 -0800 (PST)\r
+Received: (qmail 23577 invoked from network); 19 Nov 2009 00:08:13 -0000\r
+Received: from 97.126.60.213.dynamic.mundo-r.com (HELO hikari.localdomain)\r
+       (aperez@213.60.126.97)\r
+       by alice.connectical.com with ESMTPA; 19 Nov 2009 00:08:13 -0000\r
+Received: by hikari.localdomain (Postfix, from userid 500)\r
+       id E573D31DCB60; Thu, 19 Nov 2009 01:07:22 +0100 (CET)\r
+From: Adrian Perez <aperez@igalia.com>\r
+To: notmuch@notmuchmail.org\r
+Date: Thu, 19 Nov 2009 01:07:22 +0100\r
+Message-Id: <1258589242-4871-1-git-send-email-aperez@igalia.com>\r
+X-Mailer: git-send-email 1.6.5.2\r
+Subject: [notmuch] [PATCH] Allow lone "not" search operators\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 19 Nov 2009 00:08:48 -0000\r
+\r
+As suggested by Keith in FLAG_PURE_NOT allows for expressions like:\r
+\r
+  notmuch search NOT tag:inbox\r
+\r
+Note that this way a search like:\r
+\r
+  notmuch search foobar NOT tag:inbox\r
+\r
+should not be written instead:\r
+\r
+  notmuch search foobar AND NOT tag:inbox\r
+\r
+In my opinion, the latter feels more natural and is somewhat more explicit.\r
+It gives a better clue of what the search is about instead of assuming that\r
+an implicit AND operator is there.\r
+\r
+---\r
+ lib/query.cc |    3 ++-\r
+ 1 files changed, 2 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index a869f3e..75f22b3 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -97,7 +97,8 @@ notmuch_query_search_messages (notmuch_query_t *query,\r
+                             Xapian::QueryParser::FLAG_PHRASE |\r
+                             Xapian::QueryParser::FLAG_LOVEHATE |\r
+                             Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |\r
+-                            Xapian::QueryParser::FLAG_WILDCARD);\r
++                            Xapian::QueryParser::FLAG_WILDCARD |\r
++                            Xapian::QueryParser::FLAG_PURE_NOT);\r
\r
+       if (strcmp (query_string, "") == 0) {\r
+           final_query = mail_query;\r
+-- \r
+1.6.5.2\r
+\r