1 Return-Path: <todd@electricoding.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 AC8EF431FD5
\r
6 for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 15:44:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
13 tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 9nP200UGzqAJ for <notmuch@notmuchmail.org>;
\r
17 Thu, 22 Jan 2015 15:44:24 -0800 (PST)
\r
18 Received: from s75.web-hosting.com (s75.web-hosting.com [198.187.31.9])
\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 14F0F431FC9
\r
22 for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 15:44:24 -0800 (PST)
\r
23 Received: from user-69-73-37-128.knology.net ([69.73.37.128]:32799
\r
24 helo=localhost.localdomain)
\r
25 by server75.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128)
\r
26 (Exim 4.82) (envelope-from <todd@electricoding.com>)
\r
27 id 1YERQF-0036iE-6O; Thu, 22 Jan 2015 18:44:23 -0500
\r
28 From: Todd <todd@electricoding.com>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [PATCH v4 3/5] Add indexing for the mimetype term
\r
31 Date: Thu, 22 Jan 2015 17:43:38 -0600
\r
32 Message-Id: <1421970220-9019-4-git-send-email-todd@electricoding.com>
\r
33 X-Mailer: git-send-email 1.9.1
\r
34 In-Reply-To: <1421970220-9019-1-git-send-email-todd@electricoding.com>
\r
35 References: <1421970220-9019-1-git-send-email-todd@electricoding.com>
\r
36 In-Reply-To: <1420849787-4401-1-git-send-email-todd@electricoding.com>
\r
37 References: <1420849787-4401-1-git-send-email-todd@electricoding.com>
\r
38 X-AntiAbuse: This header was added to track abuse,
\r
39 please include it with any abuse report
\r
40 X-AntiAbuse: Primary Hostname - server75.web-hosting.com
\r
41 X-AntiAbuse: Original Domain - notmuchmail.org
\r
42 X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
\r
43 X-AntiAbuse: Sender Address Domain - electricoding.com
\r
44 X-Get-Message-Sender-Via: server75.web-hosting.com: authenticated_id:
\r
45 todd@electricoding.com
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Thu, 22 Jan 2015 23:44:29 -0000
\r
63 This adds the indexing support for the "mimetype:" term and removes
\r
64 the broken test flag. The indexing is probablistic in Xapian terms,
\r
65 which gives a better experience to end users. Standard content-types
\r
66 of the form "foo/bar" are automatically interpreted as phrases in
\r
67 Xapian due to the embedded slash.
\r
69 Assume, separate messages with application/pdf and application/x-pdf
\r
72 - mimetype:application/x-pdf will find only the application/x-pdf
\r
73 - mimetype:application/pdf will find only the application/pdf
\r
74 - mimetype:pdf will find both of the messages
\r
76 lib/database.cc | 1 +
\r
77 lib/index.cc | 10 ++++++++++
\r
78 test/T190-multipart.sh | 3 ---
\r
79 3 files changed, 11 insertions(+), 3 deletions(-)
\r
81 diff --git a/lib/database.cc b/lib/database.cc
\r
82 index 0d2c417..3974e2e 100644
\r
83 --- a/lib/database.cc
\r
84 +++ b/lib/database.cc
\r
85 @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= {
\r
86 { "from", "XFROM" },
\r
88 { "attachment", "XATTACHMENT" },
\r
89 + { "mimetype", "XMIMETYPE"},
\r
90 { "subject", "XSUBJECT"},
\r
93 diff --git a/lib/index.cc b/lib/index.cc
\r
94 index 1a2e63d..c88ed8d 100644
\r
97 @@ -318,6 +318,16 @@ _index_mime_part (notmuch_message_t *message,
\r
101 + GMimeContentType *content_type = g_mime_object_get_content_type(part);
\r
102 + if (content_type) {
\r
103 + char *mime_string = g_mime_content_type_to_string(content_type);
\r
106 + _notmuch_message_gen_terms (message, "mimetype", mime_string);
\r
107 + g_free(mime_string);
\r
111 if (GMIME_IS_MULTIPART (part)) {
\r
112 GMimeMultipart *multipart = GMIME_MULTIPART (part);
\r
114 diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
\r
115 index a97dc28..ad8d29e 100755
\r
116 --- a/test/T190-multipart.sh
\r
117 +++ b/test/T190-multipart.sh
\r
118 @@ -752,17 +752,14 @@ notmuch show --format=json --include-html id:htmlmessage > OUTPUT
\r
119 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"
\r
121 test_begin_subtest "indexes mime-type #1"
\r
122 -test_subtest_known_broken
\r
123 output=$(notmuch search mimetype:application/unique_identifier | notmuch_search_sanitize)
\r
124 test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)"
\r
126 test_begin_subtest "indexes mime-type #2"
\r
127 -test_subtest_known_broken
\r
128 output=$(notmuch search mimetype:text/some_other_identifier | notmuch_search_sanitize)
\r
129 test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)"
\r
131 test_begin_subtest "indexes mime-type #3"
\r
132 -test_subtest_known_broken
\r
133 output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_search_sanitize)
\r
134 test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)"
\r