Index an attachment's filename extension as well.

I hadn't realized that sup used a special term for this. But there
you go.
This commit is contained in:
Carl Worth 2009-10-14 16:35:03 -07:00
parent 29974af08f
commit 30ed705fda

View file

@ -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;
}