Adds the indexing and removes the broken test flag
---
 lib/database.cc        |  1 +
 lib/index.cc           | 10 ++++++++++
 test/T190-multipart.sh |  4 ----
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 0d2c417..3974e2e 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= {
     { "from",                  "XFROM" },
     { "to",                    "XTO" },
     { "attachment",            "XATTACHMENT" },
+    { "mimetype",              "XMIMETYPE"},
     { "subject",               "XSUBJECT"},
 };

diff --git a/lib/index.cc b/lib/index.cc
index 1a2e63d..c88ed8d 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -318,6 +318,16 @@ _index_mime_part (notmuch_message_t *message,
        return;
     }

+    GMimeContentType *content_type = g_mime_object_get_content_type(part);
+    if (content_type) {
+       char *mime_string = g_mime_content_type_to_string(content_type);
+       if (mime_string)
+       {
+           _notmuch_message_gen_terms (message, "mimetype", mime_string);
+           g_free(mime_string);
+       }
+    }
+
     if (GMIME_IS_MULTIPART (part)) {
        GMimeMultipart *multipart = GMIME_MULTIPART (part);
        int i;
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 57f1b61..de7d361 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -752,22 +752,18 @@ notmuch show --format=json --include-html id:htmlmessage 
> OUTPUT
 test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"

 test_begin_subtest "indexes mime-type #1"
-test_subtest_known_broken
 output=$(notmuch search mimetype:application/unique_identifier | 
notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2014-01-12 [1/1] Todd; odd content 
types (inbox unread)"

 test_begin_subtest "indexes mime-type #2"
-test_subtest_known_broken
 output=$(notmuch search mimetype:text/some_other_identifier | 
notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2014-01-12 [1/1] Todd; odd content 
types (inbox unread)"

 test_begin_subtest "indexes mime-type #3"
-test_subtest_known_broken
 output=$(notmuch search from:todd and mimetype:multipart/alternative | 
notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2014-01-12 [1/1] Todd; odd content 
types (inbox unread)"

 test_begin_subtest "search for non-existent mime-type"
-test_subtest_known_broken
 output=$(notmuch search mimetype:non-existent/mime-type | 
notmuch_search_sanitize)
 test_expect_equal "$output" ""

-- 
1.9.1

Reply via email to