1 Return-Path: <jani@nikula.org>
\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 E0887431E64
\r
6 for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:13:04 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=1.738 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7]
\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 YZd839BIRTqo for <notmuch@notmuchmail.org>;
\r
17 Sat, 10 Jan 2015 04:13:01 -0800 (PST)
\r
18 Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com
\r
19 [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 057B7431FAF for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:13:01 -0800
\r
23 Received: by mail-wg0-f51.google.com with SMTP id x12so12235571wgg.10
\r
24 for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:12:59 -0800 (PST)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:subject:in-reply-to:references
\r
28 :user-agent:date:message-id:mime-version:content-type;
\r
29 bh=qyewTrDxRgBL0ElwA74BVsu5aODFBpuk0lSWb5qt/+Q=;
\r
30 b=GUtG2CKWj/obDHbhC7hwi3+GjjeMmqCCVYx8lNwnUE0YYR7T2IIB1EJb5bBxF6Vi74
\r
31 hqQAXbgkF5waLHUOnjugs9K95S2zXcGXAsYPG/wKijbG+QbOTTbSGt8AXVqIWbm15F8v
\r
32 Z1dg9WQAO1PutC3/5hXVfLVZiBOibeHFQWKTRzyB23DeUOJ9n+/dzJZhP/uUm8yHeuWs
\r
33 eYrJ6GIk1RcJKfwKXGwlaBNbJUnNU/F3MWIEN1TNaLb4dWv/8nL4QjLn1H3gR4ZyPegE
\r
34 0oFfp2J4JCn3QuYRUV1FvafsH42v6T0j50hwUGH5g6/zMVxl5JZV6OvYP/lIpxduaOc1
\r
37 ALoCoQmGwSVpDeUQd2tPiVlc8KhPvTMpw/JX7x1T5Gd4xZb3+dd7KztrIg+ShvJsQ2rSOSgxa1r4
\r
38 X-Received: by 10.180.21.225 with SMTP id y1mr13417812wie.42.1420891979749;
\r
39 Sat, 10 Jan 2015 04:12:59 -0800 (PST)
\r
40 Received: from localhost (mobile-internet-bcee14-89.dhcp.inet.fi.
\r
42 by mx.google.com with ESMTPSA id r3sm2150348wic.10.2015.01.10.04.12.58
\r
43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
44 Sat, 10 Jan 2015 04:12:59 -0800 (PST)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: Todd <todd@electricoding.com>, notmuch@notmuchmail.org
\r
47 Subject: Re: [PATCH] Index Content-Type of attachments with a contenttype
\r
49 In-Reply-To: <1420849787-4401-1-git-send-email-todd@electricoding.com>
\r
50 References: <1420849787-4401-1-git-send-email-todd@electricoding.com>
\r
51 User-Agent: Notmuch/0.19+6~gf2e3d2c (http://notmuchmail.org) Emacs/24.4.1
\r
52 (x86_64-pc-linux-gnu)
\r
53 Date: Sat, 10 Jan 2015 14:13:09 +0200
\r
54 Message-ID: <8761ce7s16.fsf@nikula.org>
\r
56 Content-Type: text/plain
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sat, 10 Jan 2015 12:13:05 -0000
\r
71 On Sat, 10 Jan 2015, Todd <todd@electricoding.com> wrote:
\r
72 > I wanted to tag messages with calendar invitations, but couldn't as
\r
73 > the information wasn't indexed.
\r
75 > This patch allows for queries for like:
\r
77 > Find calendar invites
\r
78 > - contenttype:text/calendar or contenttype:applicaton/ics
\r
80 > Find any image attachments
\r
81 > - contenttype:image
\r
84 > - contenttype:text/x-patch
\r
91 > completion/notmuch-completion.bash | 2 +-
\r
92 > doc/man7/notmuch-search-terms.rst | 6 ++++++
\r
93 > emacs/notmuch.el | 2 +-
\r
94 > lib/database.cc | 1 +
\r
95 > lib/index.cc | 5 +++++
\r
96 > test/T190-multipart.sh | 32 ++++++++++++++++++++++++++++++++
\r
98 IMO these could be split into several patches.
\r
100 > 7 files changed, 52 insertions(+), 2 deletions(-)
\r
102 > diff --git a/NEWS b/NEWS
\r
103 > index 44e8d05..5f4622c 100644
\r
106 > @@ -15,6 +15,12 @@ keyboard shortcuts to saved searches.
\r
107 > Command-Line Interface
\r
108 > ----------------------
\r
110 > +There is a new `contenttype:` search prefix
\r
112 > + The new `contenttype:` search prefix allows searching for the
\r
113 > + content-type of attachments, which is now indexed by `notmuch
\r
114 > + insert`. See the `notmuch-search-terms` manual page for details.
\r
117 Admittedly I did not have the time to dig into details, but I think
\r
118 "attachment" is misleading, as it's really all mime parts, right?
\r
120 Will this also index the Content-Type: header of the message itself,
\r
121 regardless of whether it has mime structure or not? Maybe it should?
\r
123 > Stopped `notmuch dump` failing if someone writes to the database
\r
125 > The dump command now takes the write lock when running. This
\r
126 > diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
\r
127 > index d58dc8b..05b5969 100644
\r
128 > --- a/completion/notmuch-completion.bash
\r
129 > +++ b/completion/notmuch-completion.bash
\r
130 > @@ -61,7 +61,7 @@ _notmuch_search_terms()
\r
131 > sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
\r
134 > - local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:"
\r
135 > + local search_terms="from: to: subject: attachment: contenttype: tag: id: thread: folder: path: date:"
\r
136 > compopt -o nospace
\r
137 > COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
\r
139 > diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst
\r
140 > index 1acdaa0..d126ce6 100644
\r
141 > --- a/doc/man7/notmuch-search-terms.rst
\r
142 > +++ b/doc/man7/notmuch-search-terms.rst
\r
143 > @@ -40,6 +40,8 @@ indicate user-supplied values):
\r
145 > - attachment:<word>
\r
147 > +- contenttype:<word>
\r
149 > - tag:<tag> (or is:<tag>)
\r
151 > - id:<message-id>
\r
152 > @@ -66,6 +68,10 @@ by including quotation marks around the phrase, immediately following
\r
153 > The **attachment:** prefix can be used to search for specific filenames
\r
154 > (or extensions) of attachments to email messages.
\r
156 > +The **contenttype:** prefix can be used to search for specific
\r
157 > +content-types of attachments to email messages (as specified by the
\r
160 > For **tag:** and **is:** valid tag values include **inbox** and
\r
161 > **unread** by default for new messages added by **notmuch new** as well
\r
162 > as any other tag values added manually with **notmuch tag**.
\r
163 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
164 > index 218486a..702700c 100644
\r
165 > --- a/emacs/notmuch.el
\r
166 > +++ b/emacs/notmuch.el
\r
167 > @@ -858,7 +858,7 @@ PROMPT is the string to prompt with."
\r
170 > (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
\r
171 > - "subject:" "attachment:")
\r
172 > + "subject:" "attachment:" "contenttype:")
\r
173 > (mapcar (lambda (tag)
\r
174 > (concat "tag:" (notmuch-escape-boolean-term tag)))
\r
175 > (process-lines notmuch-command "search" "--output=tags" "*")))))
\r
176 > diff --git a/lib/database.cc b/lib/database.cc
\r
177 > index 3601f9d..a7a64c9 100644
\r
178 > --- a/lib/database.cc
\r
179 > +++ b/lib/database.cc
\r
180 > @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= {
\r
181 > { "from", "XFROM" },
\r
183 > { "attachment", "XATTACHMENT" },
\r
184 > + { "contenttype", "XCONTENTTYPE"},
\r
185 > { "subject", "XSUBJECT"},
\r
187 Is the use of probabilistic prefix intentional? I think it's probably
\r
188 the right thing to do, but just checking.
\r
195 > diff --git a/lib/index.cc b/lib/index.cc
\r
196 > index 1a2e63d..c3f7c6b 100644
\r
197 > --- a/lib/index.cc
\r
198 > +++ b/lib/index.cc
\r
199 > @@ -346,6 +346,11 @@ _index_mime_part (notmuch_message_t *message,
\r
203 > + GMimeContentType* content_type = g_mime_object_get_content_type(part);
\r
204 > + if (content_type) {
\r
205 > + _notmuch_message_gen_terms (message, "contenttype", g_mime_content_type_to_string(content_type));
\r
208 > if (GMIME_IS_MESSAGE_PART (part)) {
\r
209 > GMimeMessage *mime_message;
\r
211 > diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
\r
212 > index 85cbf67..e3270a7 100755
\r
213 > --- a/test/T190-multipart.sh
\r
214 > +++ b/test/T190-multipart.sh
\r
215 > @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64
\r
220 > +cat <<EOF > content_types
\r
221 > +From: Todd <todd@electricoding.com>
\r
222 > +To: todd@electricoding.com
\r
223 > +Subject: odd content types
\r
224 > +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
225 > +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
\r
226 > +Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org>
\r
227 > +MIME-Version: 1.0
\r
228 > +Content-Type: multipart/alternative; boundary="==-=-=="
\r
231 > +Content-Type: application/unique_identifier
\r
233 > +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
236 > +Content-Type: text/some_other_identifier
\r
238 > +This is an embedded message, with a multipart/alternative part.
\r
242 > +cat content_types >> ${MAIL_DIR}/odd_content_type
\r
243 > notmuch new > /dev/null
\r
245 > test_begin_subtest "--format=text --part=0, full message"
\r
246 > @@ -727,4 +751,12 @@ test_begin_subtest "html parts included"
\r
247 > notmuch show --format=json --include-html id:htmlmessage > OUTPUT
\r
248 > test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"
\r
250 > +test_begin_subtest "indexes content-type"
\r
251 > +output=$(notmuch search contenttype:application/unique_identifier | notmuch_search_sanitize)
\r
252 > +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Todd; odd content types (inbox unread)"
\r
254 > +output=$(notmuch search contenttype:text/some_other_identifier | notmuch_search_sanitize)
\r
255 > +test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Todd; odd content types (inbox unread)"
\r
261 > _______________________________________________
\r
262 > notmuch mailing list
\r
263 > notmuch@notmuchmail.org
\r
264 > http://notmuchmail.org/mailman/listinfo/notmuch
\r