[WIP 0/2] Thread based searching
authorMark Walters <markwalters1009@gmail.com>
Tue, 20 Mar 2012 20:11:58 +0000 (20:11 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:38 +0000 (09:45 -0800)
19/6920ad644d3277c862da1df31d1b066eca529b [new file with mode: 0644]

diff --git a/19/6920ad644d3277c862da1df31d1b066eca529b b/19/6920ad644d3277c862da1df31d1b066eca529b
new file mode 100644 (file)
index 0000000..46882fd
--- /dev/null
@@ -0,0 +1,116 @@
+Return-Path: <markwalters1009@gmail.com>\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 EEBF1431FAF\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:05 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 TfjdIjxXJI-g for <notmuch@notmuchmail.org>;\r
+       Tue, 20 Mar 2012 13:12:05 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 422F9431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:05 -0700 (PDT)\r
+Received: by werm13 with SMTP id m13so416476wer.26\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:04 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=09K+GUwRn4P2+xpXIHtS4t8ui0oifHzdeRp+NuMC+rw=;\r
+       b=QArwfiprLSgH9dqsybhqqDACMhZ2J9CaH4bNM5J+Clsc4I+aSbQx523Ow0KfgRjCL+\r
+       2baZqLUEtFBONyf2zfU3ftq3+KuNuvxSDKIfJCbsWDwX2STQeZd2L7tFIEkwjMZTpLpQ\r
+       RBILfzicx7vRGepnSXOvIFzpH8iPpesNZPshJQpfhHbs+I54aOlvFUuZ0k7CpMBkz4UN\r
+       BfnaULrmCdcQA0Qa4Uf05oU4d9kJhM/a1ImR/735d7nTpShzEndPUSSdZuNMnxsM+9vi\r
+       Edp1cRfu48kAS4/yIpVnEwLAmpxU2qiivAnITY7oDJs2YaH6HmpdEmpLchVX8Vd2mraM\r
+       IMzA==\r
+Received: by 10.180.88.67 with SMTP id be3mr2678397wib.20.1332274323946;\r
+       Tue, 20 Mar 2012 13:12:03 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ gp8sm36537636wib.5.2012.03.20.13.12.01        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 20 Mar 2012 13:12:02 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [WIP 0/2] Thread based searching\r
+Date: Tue, 20 Mar 2012 20:11:58 +0000\r
+Message-Id: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Tue, 20 Mar 2012 20:12:06 -0000\r
+\r
+This is very definitely only a work in progress but there have been\r
+several requests for this or something similar on irc.\r
+\r
+It implements a very crude form of thread based search: the user can\r
+ask for all the threads that have a message matching the primary query\r
+and have a (possibly different) message matching a secondary query.\r
+\r
+For example notmuch search --secondary-search from:A :AND: from:B\r
+returns all threads that have a message from A and a message from B.\r
+\r
+Similarly it allows the user to say "and not" on a thread based way.\r
+\r
+For example notmuch search --secondary-search from:A :AND_NOT:\r
+tag:mute returns all threads that have a message from A and no message\r
+with tag:mute.\r
+\r
+Anything allowing queries of this form is going to have to do some\r
+parsing of the query (rather than leaving this to xapian). To keep\r
+things as simple as possible this version only tries parsing of this\r
+form if passed --secondary-search and it assumes the last command line\r
+argument is the entire secondary search (so any complex secondary\r
+search should be independently quoted) and that the penultimate\r
+command line argument is either :AND: or :AND_NOT: for thread based\r
+"and" or thread based "and not" respectively.\r
+\r
+Finally, the two queries do play a different role even in the :AND:\r
+case. The threads returned are exactly those that match the primary\r
+query in (the order that would normally give) just filtered by\r
+containing a message matching the secondary query. Thus a search for\r
+query_a :AND query_b and a search for query_b :AND: query_a return\r
+threads in different orders, and one may be much faster than the\r
+other.\r
+\r
+At the moment this is purely lib and cli (ie no emacs interface).\r
+\r
+It is also not heavily tested and interactions with excludes or\r
+anything unusual could easily give strange results.\r
+\r
+Anyway I am just posting this in case anyone is interested.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+Mark Walters (2):\r
+  lib: multithread\r
+  cli: search: multithread\r
+\r
+ lib/notmuch.h    |   12 ++++++++++++\r
+ lib/query.cc     |   46 +++++++++++++++++++++++++++++++++++++++++++++-\r
+ notmuch-search.c |   19 +++++++++++++++++++\r
+ 3 files changed, 76 insertions(+), 1 deletions(-)\r
+\r
+-- \r
+1.7.9.1\r
+\r