aboutsummaryrefslogtreecommitdiff
path: root/lib/index.cc
diff options
context:
space:
mode:
authorTodd <todd@electricoding.com>2015-01-22 17:43:38 -0600
committerDavid Bremner <david@tethera.net>2015-01-24 16:47:59 +0100
commitb04bc967f9837e9d451ef88c276c744aa55accaa (patch)
treec75cfd2569930441556d89bf2bd9c2b4c801c003 /lib/index.cc
parent0de999aab5bd4cd44bc4ea76fd1d25172bd839ae (diff)
Add indexing for the mimetype term
This adds the indexing support for the "mimetype:" term and removes the broken test flag. The indexing is probablistic in Xapian terms, which gives a better experience to end users. Standard content-types of the form "foo/bar" are automatically interpreted as phrases in Xapian due to the embedded slash. Assume, separate messages with application/pdf and application/x-pdf are indexed, then: - mimetype:application/x-pdf will find only the application/x-pdf - mimetype:application/pdf will find only the application/pdf - mimetype:pdf will find both of the messages
Diffstat (limited to 'lib/index.cc')
-rw-r--r--lib/index.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/index.cc b/lib/index.cc
index 1a2e63df..c88ed8d7 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;