aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-14 16:35:03 -0700
committerCarl Worth <cworth@cworth.org>2009-10-14 16:35:03 -0700
commit30ed705fda4647a19ad243c9301187bb45bf9de8 (patch)
tree32917124a8a0f9d43587a27bd9937c454aa11081
parent29974af08f2eb3ebdff3ae1052a07b6d7361d511 (diff)
Index an attachment's filename extension as well.
I hadn't realized that sup used a special term for this. But there you go.
-rw-r--r--notmuch-index-message.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/notmuch-index-message.cc b/notmuch-index-message.cc
index 636757a1..3270aac7 100644
--- a/notmuch-index-message.cc
+++ b/notmuch-index-message.cc
@@ -443,9 +443,20 @@ gen_terms_part (Xapian::TermGenerator term_gen,
if (disposition &&
strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
{
+ const char *filename = g_mime_part_get_filename (GMIME_PART (part));
+ const char *extension;
+
add_term (term_gen.get_document (), "label", "attachment");
- gen_terms (term_gen, "attachment",
- g_mime_part_get_filename (GMIME_PART (part)));
+ gen_terms (term_gen, "attachment", filename);
+
+ if (filename) {
+ extension = strchr (filename, '.');
+ if (extension) {
+ add_term (term_gen.get_document (), "attachment_extension",
+ extension + 1);
+ }
+ }
+
return;
}