[PATCH v2 3/5] Add indexing for the mimetype term

Todd todd at electricoding.com
Tue Jan 13 16:00:26 PST 2015


---
 lib/database.cc | 1 +
 lib/index.cc    | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 2de60f8..7c7a267 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..2e27558 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -318,6 +318,12 @@ _index_mime_part (notmuch_message_t *message,
 	return;
     }
 
+
+    GMimeContentType*  content_type = g_mime_object_get_content_type(part);
+    if (content_type) {
+	_notmuch_message_gen_terms (message, "mimetype", g_mime_content_type_to_string(content_type));
+    }
+
     if (GMIME_IS_MULTIPART (part)) {
 	GMimeMultipart *multipart = GMIME_MULTIPART (part);
 	int i;
-- 
1.9.1



More information about the notmuch mailing list