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 C6A3F429E43
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:39:17 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 kumXNNYITpqd for <notmuch@notmuchmail.org>;
\r
18 Sun, 29 Jan 2012 10:39:17 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.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 CF78E429E3F
\r
23 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:39:16 -0800 (PST)
\r
24 Received: by mail-wi0-f181.google.com with SMTP id hi8so2994807wib.26
\r
25 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:39:16 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=FRNIcU3Vg8SGLOPnGgF+vtus3AO/X2vhJdlEHj+FuVo=;
\r
29 b=NYiudrcM4E+erHA2HshEJ5FxtTZMea+x/DOGLssJyC+k5xXy2UnDrvPmwtXqtBPpLi
\r
30 1glNOfwzqJxWOPp8I5EwIWdpE0XwSyWxeBWyUvQI64vBhPrMeC6dNc5YpdqrwzmX0vSq
\r
31 IsiZON97soyGEbquoKgmqBc54A4+9y++RVsK0=
\r
32 Received: by 10.180.95.199 with SMTP id dm7mr23007942wib.9.1327862356592;
\r
33 Sun, 29 Jan 2012 10:39:16 -0800 (PST)
\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
35 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
36 hc10sm25184040wib.8.2012.01.29.10.39.15 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sun, 29 Jan 2012 10:39:15 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org,
\r
41 Subject: [PATCH 4/7] lib: Add the exclude flag to notmuch_query_search_threads
\r
42 Date: Sun, 29 Jan 2012 18:39:51 +0000
\r
43 Message-Id: <1327862394-14334-4-git-send-email-markwalters1009@gmail.com>
\r
44 X-Mailer: git-send-email 1.7.2.3
\r
45 In-Reply-To: <8762fu4aqt.fsf@qmul.ac.uk>
\r
46 References: <8762fu4aqt.fsf@qmul.ac.uk>
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\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: Sun, 29 Jan 2012 18:39:17 -0000
\r
61 Add the NOTMUCH_MESSAGE_FLAG_EXCLUDED flag to
\r
62 notmuch_query_search_threads. Implemented by inspecting the tags
\r
63 directly in _notmuch_thread_create/_thread_add_message rather than as
\r
64 a Xapian query for speed reasons.
\r
66 lib/notmuch-private.h | 16 ++++++++++------
\r
68 lib/thread.cc | 18 +++++++++++++++---
\r
69 3 files changed, 26 insertions(+), 9 deletions(-)
\r
71 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
72 index e791bb0..56b87c6 100644
\r
73 --- a/lib/notmuch-private.h
\r
74 +++ b/lib/notmuch-private.h
\r
75 @@ -211,12 +211,8 @@ _notmuch_directory_get_document_id (notmuch_directory_t *directory);
\r
80 -_notmuch_thread_create (void *ctx,
\r
81 - notmuch_database_t *notmuch,
\r
82 - unsigned int seed_doc_id,
\r
83 - notmuch_doc_id_set_t *match_set,
\r
84 - notmuch_sort_t sort);
\r
85 +/* Definition of _notmuch_thread_create moved later since now uses
\r
86 + * string_list_t */
\r
90 @@ -492,6 +488,14 @@ notmuch_filenames_t *
\r
91 _notmuch_filenames_create (const void *ctx,
\r
92 notmuch_string_list_t *list);
\r
95 +_notmuch_thread_create (void *ctx,
\r
96 + notmuch_database_t *notmuch,
\r
97 + unsigned int seed_doc_id,
\r
98 + notmuch_doc_id_set_t *match_set,
\r
99 + notmuch_string_list_t *excluded_terms,
\r
100 + notmuch_sort_t sort);
\r
102 #pragma GCC visibility pop
\r
105 diff --git a/lib/query.cc b/lib/query.cc
\r
106 index 7d165d2..dee7ec0 100644
\r
109 @@ -472,6 +472,7 @@ notmuch_threads_get (notmuch_threads_t *threads)
\r
110 threads->query->notmuch,
\r
112 &threads->match_set,
\r
113 + threads->query->exclude_terms,
\r
114 threads->query->sort);
\r
117 diff --git a/lib/thread.cc b/lib/thread.cc
\r
118 index 0435ee6..6d65d52 100644
\r
119 --- a/lib/thread.cc
\r
120 +++ b/lib/thread.cc
\r
121 @@ -214,7 +214,8 @@ _thread_cleanup_author (notmuch_thread_t *thread,
\r
124 _thread_add_message (notmuch_thread_t *thread,
\r
125 - notmuch_message_t *message)
\r
126 + notmuch_message_t *message,
\r
127 + notmuch_string_list_t *exclude_terms)
\r
129 notmuch_tags_t *tags;
\r
131 @@ -262,6 +263,15 @@ _thread_add_message (notmuch_thread_t *thread,
\r
132 notmuch_tags_move_to_next (tags))
\r
134 tag = notmuch_tags_get (tags);
\r
135 + /* mark excluded messages */
\r
136 + for (notmuch_string_node_t *term = exclude_terms->head; term;
\r
137 + term = term->next) {
\r
138 + /* we ignore initial 'K' */
\r
139 + if (strcmp(tag, (term->string + 1)) == 0) {
\r
140 + notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);
\r
144 g_hash_table_insert (thread->tags, xstrdup (tag), NULL);
\r
147 @@ -321,7 +331,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,
\r
148 _thread_set_subject_from_message (thread, message);
\r
151 - thread->matched_messages++;
\r
152 + if (!notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED))
\r
153 + thread->matched_messages++;
\r
155 if (g_hash_table_lookup_extended (thread->message_hash,
\r
156 notmuch_message_get_message_id (message), NULL,
\r
157 @@ -392,6 +403,7 @@ _notmuch_thread_create (void *ctx,
\r
158 notmuch_database_t *notmuch,
\r
159 unsigned int seed_doc_id,
\r
160 notmuch_doc_id_set_t *match_set,
\r
161 + notmuch_string_list_t *exclude_terms,
\r
162 notmuch_sort_t sort)
\r
164 notmuch_thread_t *thread;
\r
165 @@ -467,7 +479,7 @@ _notmuch_thread_create (void *ctx,
\r
166 if (doc_id == seed_doc_id)
\r
167 message = seed_message;
\r
169 - _thread_add_message (thread, message);
\r
170 + _thread_add_message (thread, message, exclude_terms);
\r
172 if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {
\r
173 _notmuch_doc_id_set_remove (match_set, doc_id);
\r