1 Return-Path: <m.walters@qmul.ac.uk>
\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 48B86429E54
\r
6 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 03:19:36 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id cEzCquZN7hl7 for <notmuch@notmuchmail.org>;
\r
17 Tue, 24 Jan 2012 03:19:33 -0800 (PST)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id A8D29429E21
\r
22 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 03:19:33 -0800 (PST)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1RpePR-0001mB-4L; Tue, 24 Jan 2012 11:19:29 +0000
\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]
\r
29 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
30 (envelope-from <m.walters@qmul.ac.uk>)
\r
31 id 1RpePQ-0000Nv-Pe; Tue, 24 Jan 2012 11:19:29 +0000
\r
32 From: Mark Walters <markwalters1009@gmail.com>
\r
33 To: Austin Clements <amdragon@MIT.EDU>
\r
34 Subject: Re: [RFC PATCH 2/4] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag
\r
35 In-Reply-To: <20120124024521.GY16740@mit.edu>
\r
36 References: <20120124011609.GX16740@mit.edu>
\r
37 <1327367923-18228-2-git-send-email-markwalters1009@gmail.com>
\r
38 <20120124024521.GY16740@mit.edu>
\r
39 User-Agent: Notmuch/0.11+99~g7f60f7e (http://notmuchmail.org) Emacs/23.2.1
\r
41 Date: Tue, 24 Jan 2012 11:20:26 +0000
\r
42 Message-ID: <87obttgxdx.fsf@qmul.ac.uk>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 X-Sender-Host-Address: 94.192.233.223
\r
46 X-QM-SPAM-Info: Sender has good ham record. :)
\r
47 X-QM-Body-MD5: 341468acf6adfd48c99f77a5f10f9cd8 (of first 20000 bytes)
\r
48 X-SpamAssassin-Score: -1.8
\r
49 X-SpamAssassin-SpamBar: -
\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
52 spam. We require at least 5.0 points to mark a message as spam.
\r
53 This message scored -1.8 points.
\r
54 Summary of the scoring:
\r
55 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
57 * [138.37.6.40 listed in list.dnswl.org]
\r
58 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
59 provider * (markwalters1009[at]gmail.com)
\r
60 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
62 * 0.5 AWL AWL: From: address is in the auto white-list
\r
63 X-QM-Scan-Virus: ClamAV says the message is clean
\r
64 Cc: notmuch@notmuchmail.org
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Tue, 24 Jan 2012 11:19:36 -0000
\r
79 On Mon, 23 Jan 2012 21:45:21 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
80 > The overall structure of this series looks great. There's obviously a
\r
81 > lot of clean up to do, but I'll reply with a few high-level comments.
\r
83 > Quoth Mark Walters on Jan 24 at 1:18 am:
\r
84 > > Form excluded doc_ids set and use that to exclude messages.
\r
85 > > Should be no functional change.
\r
88 > > lib/notmuch-private.h | 1 +
\r
89 > > lib/query.cc | 28 ++++++++++++++++++++++++++--
\r
90 > > 2 files changed, 27 insertions(+), 2 deletions(-)
\r
92 > > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
93 > > index 7bf153e..e791bb0 100644
\r
94 > > --- a/lib/notmuch-private.h
\r
95 > > +++ b/lib/notmuch-private.h
\r
96 > > @@ -401,6 +401,7 @@ typedef struct _notmuch_message_list {
\r
98 > > struct visible _notmuch_messages {
\r
99 > > notmuch_bool_t is_of_list_type;
\r
100 > > + notmuch_doc_id_set_t *excluded_doc_ids;
\r
101 > > notmuch_message_node_t *iterator;
\r
104 > > diff --git a/lib/query.cc b/lib/query.cc
\r
105 > > index c25b301..92fa834 100644
\r
106 > > --- a/lib/query.cc
\r
107 > > +++ b/lib/query.cc
\r
108 > > @@ -57,6 +57,11 @@ struct visible _notmuch_threads {
\r
109 > > notmuch_doc_id_set_t match_set;
\r
112 > > +static notmuch_bool_t
\r
113 > > +_notmuch_doc_id_set_init (void *ctx,
\r
114 > > + notmuch_doc_id_set_t *doc_ids,
\r
115 > > + GArray *arr);
\r
117 > > notmuch_query_t *
\r
118 > > notmuch_query_create (notmuch_database_t *notmuch,
\r
119 > > const char *query_string)
\r
120 > > @@ -173,6 +178,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
\r
122 > > Xapian::Query string_query, final_query, exclude_query;
\r
123 > > Xapian::MSet mset;
\r
124 > > + Xapian::MSetIterator iterator;
\r
125 > > unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
126 > > Xapian::QueryParser::FLAG_PHRASE |
\r
127 > > Xapian::QueryParser::FLAG_LOVEHATE |
\r
128 > > @@ -193,8 +199,21 @@ notmuch_query_search_messages (notmuch_query_t *query)
\r
130 > > exclude_query = _notmuch_exclude_tags (query, final_query);
\r
132 > > - final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
\r
133 > > - final_query, exclude_query);
\r
134 > > + enquire.set_weighting_scheme (Xapian::BoolWeight());
\r
135 > > + enquire.set_query (exclude_query);
\r
137 > > + mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
\r
139 > > + GArray *excluded_doc_ids = g_array_new (FALSE, FALSE, sizeof (unsigned int));
\r
141 > > + for (iterator = mset.begin (); iterator != mset.end (); iterator++)
\r
143 > > + unsigned int doc_id = *iterator;
\r
144 > > + g_array_append_val (excluded_doc_ids, doc_id);
\r
146 > > + messages->base.excluded_doc_ids = talloc (query, _notmuch_doc_id_set);
\r
147 > > + _notmuch_doc_id_set_init (query, messages->base.excluded_doc_ids,
\r
148 > > + excluded_doc_ids);
\r
150 > This might be inefficient for message-only queries, since it will
\r
151 > fetch *all* excluded docids. This highlights a basic difference
\r
152 > between message and thread search: thread search can return messages
\r
153 > that don't match the original query and hence needs to know all
\r
154 > potentially excluded messages, while message search can only return
\r
155 > messages that match the original query.
\r
157 > It's entirely possible this doesn't matter because Xapian probably
\r
158 > still needs to fetch the full posting lists of the excluded terms, but
\r
159 > it would be worth doing a quick/hacky benchmark to verify this, with
\r
160 > enough excluded messages to make the cost non-trivial.
\r
162 > If it does matter, you could pass in a flag indicating if the exclude
\r
163 > query should be limited by the original query or not. Or you could do
\r
164 > the limited exclude query in notmuch_query_search_messages and a
\r
165 > separate open-ended exclude query in notmuch_query_search_threads.
\r
167 Yes I will benchmark that: I am just importing a large archive into
\r
168 notmuch for testing.
\r
170 > > enquire.set_weighting_scheme (Xapian::BoolWeight());
\r
172 > > @@ -294,6 +313,11 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
\r
173 > > mset_messages = (notmuch_mset_messages_t *) messages;
\r
175 > > mset_messages->iterator++;
\r
177 > > + while ((mset_messages->iterator != mset_messages->iterator_end) &&
\r
178 > > + (_notmuch_doc_id_set_contains (messages->excluded_doc_ids,
\r
179 > > + *mset_messages->iterator)))
\r
180 > > + mset_messages->iterator++;
\r
182 > This seemed a little weird, since you remove it in the next patch. Is
\r
183 > this just to keep the tests happy? (If so, it would be worth
\r
184 > mentioning in the commit message; other reviewers will definitely have
\r
185 > the same question.)
\r
187 Essentially just to keep tests happy: or rather to try and make it easy
\r
188 for a reviewer to see that the individual patch does not make any
\r