aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-13 17:01:43 -0700
committerCarl Worth <cworth@cworth.org>2009-10-13 21:14:55 -0700
commit1479b99b50c3a8f75cd301787cf663fd36c2345f (patch)
treea8d840be240ea05f970fa22dadcedb12a1d51539
parent9bf3cda34c40089085c1ce612fd5027ae9a2f314 (diff)
notmuch-index-message: Don't index the "re:" prefix in subjects.
Getting closer to sup results all the time.
-rw-r--r--notmuch-index-message.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/notmuch-index-message.cc b/notmuch-index-message.cc
index 44b1b03a..3e81ecde 100644
--- a/notmuch-index-message.cc
+++ b/notmuch-index-message.cc
@@ -187,6 +187,23 @@ add_terms_address_addrs (Xapian::Document doc,
}
}
+static const char *
+skip_re_in_subject (const char *subject)
+{
+ const char *s = subject;
+
+ while (*s) {
+ while (*s && isspace (*s))
+ s++;
+ if (strncasecmp (s, "re:", 3) == 0)
+ s += 3;
+ else
+ break;
+ }
+
+ return s;
+}
+
/* Generate terms for the body of a message, given the filename of the
* message and the offset at which the headers of the message end,
* (and hence the body begins). */
@@ -337,6 +354,7 @@ main (int argc, char **argv)
gen_terms_address_names (term_gen, addresses, "to_name");
value = g_mime_message_get_subject (message);
+ value = skip_re_in_subject (value);
gen_terms (term_gen, "subject", value);
gen_terms (term_gen, "body", value);