[WIP 0/2] Thread based searching
[notmuch-archives.git] / 19 / 6920ad644d3277c862da1df31d1b066eca529b
1 Return-Path: <markwalters1009@gmail.com>\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 EEBF1431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:05 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id TfjdIjxXJI-g for <notmuch@notmuchmail.org>;\r
18         Tue, 20 Mar 2012 13:12:05 -0700 (PDT)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 422F9431FAE\r
23         for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:05 -0700 (PDT)\r
24 Received: by werm13 with SMTP id m13so416476wer.26\r
25         for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:04 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer;\r
28         bh=09K+GUwRn4P2+xpXIHtS4t8ui0oifHzdeRp+NuMC+rw=;\r
29         b=QArwfiprLSgH9dqsybhqqDACMhZ2J9CaH4bNM5J+Clsc4I+aSbQx523Ow0KfgRjCL+\r
30         2baZqLUEtFBONyf2zfU3ftq3+KuNuvxSDKIfJCbsWDwX2STQeZd2L7tFIEkwjMZTpLpQ\r
31         RBILfzicx7vRGepnSXOvIFzpH8iPpesNZPshJQpfhHbs+I54aOlvFUuZ0k7CpMBkz4UN\r
32         BfnaULrmCdcQA0Qa4Uf05oU4d9kJhM/a1ImR/735d7nTpShzEndPUSSdZuNMnxsM+9vi\r
33         Edp1cRfu48kAS4/yIpVnEwLAmpxU2qiivAnITY7oDJs2YaH6HmpdEmpLchVX8Vd2mraM\r
34         IMzA==\r
35 Received: by 10.180.88.67 with SMTP id be3mr2678397wib.20.1332274323946;\r
36         Tue, 20 Mar 2012 13:12:03 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  gp8sm36537636wib.5.2012.03.20.13.12.01 (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Tue, 20 Mar 2012 13:12:02 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [WIP 0/2] Thread based searching\r
44 Date: Tue, 20 Mar 2012 20:11:58 +0000\r
45 Message-Id: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Tue, 20 Mar 2012 20:12:06 -0000\r
60 \r
61 This is very definitely only a work in progress but there have been\r
62 several requests for this or something similar on irc.\r
63 \r
64 It implements a very crude form of thread based search: the user can\r
65 ask for all the threads that have a message matching the primary query\r
66 and have a (possibly different) message matching a secondary query.\r
67 \r
68 For example notmuch search --secondary-search from:A :AND: from:B\r
69 returns all threads that have a message from A and a message from B.\r
70 \r
71 Similarly it allows the user to say "and not" on a thread based way.\r
72 \r
73 For example notmuch search --secondary-search from:A :AND_NOT:\r
74 tag:mute returns all threads that have a message from A and no message\r
75 with tag:mute.\r
76 \r
77 Anything allowing queries of this form is going to have to do some\r
78 parsing of the query (rather than leaving this to xapian). To keep\r
79 things as simple as possible this version only tries parsing of this\r
80 form if passed --secondary-search and it assumes the last command line\r
81 argument is the entire secondary search (so any complex secondary\r
82 search should be independently quoted) and that the penultimate\r
83 command line argument is either :AND: or :AND_NOT: for thread based\r
84 "and" or thread based "and not" respectively.\r
85 \r
86 Finally, the two queries do play a different role even in the :AND:\r
87 case. The threads returned are exactly those that match the primary\r
88 query in (the order that would normally give) just filtered by\r
89 containing a message matching the secondary query. Thus a search for\r
90 query_a :AND query_b and a search for query_b :AND: query_a return\r
91 threads in different orders, and one may be much faster than the\r
92 other.\r
93 \r
94 At the moment this is purely lib and cli (ie no emacs interface).\r
95 \r
96 It is also not heavily tested and interactions with excludes or\r
97 anything unusual could easily give strange results.\r
98 \r
99 Anyway I am just posting this in case anyone is interested.\r
100 \r
101 Best wishes\r
102 \r
103 Mark\r
104 \r
105 Mark Walters (2):\r
106   lib: multithread\r
107   cli: search: multithread\r
108 \r
109  lib/notmuch.h    |   12 ++++++++++++\r
110  lib/query.cc     |   46 +++++++++++++++++++++++++++++++++++++++++++++-\r
111  notmuch-search.c |   19 +++++++++++++++++++\r
112  3 files changed, 76 insertions(+), 1 deletions(-)\r
113 \r
114 -- \r
115 1.7.9.1\r
116 \r