From e15bb738ea5a9e6db1982c3b979ff4e6b55b54b7 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 2 Nov 2010 00:06:17 +0200 Subject: [PATCH] * store normalized version of strings as well (value) --- src/mu-store.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mu-store.cc b/src/mu-store.cc index 05d56be1..79c5f0f0 100644 --- a/src/mu-store.cc +++ b/src/mu-store.cc @@ -29,6 +29,7 @@ #include "mu-msg-contact.h" #include "mu-store.h" #include "mu-util.h" +#include "mu-msg-str.h" /* number of new messages after which we commit to the database */ #define MU_STORE_TRX_SIZE 6666 @@ -214,12 +215,18 @@ add_terms_values_string (Xapian::Document& doc, MuMsg *msg, termgen.index_text_without_positions (str, 1, prefix); } - if (mu_msg_field_xapian_term(field)) + if (mu_msg_field_xapian_term(field)) { /* terms can be up to MU_STORE_MAX_TERM_LENGTH (240) * long; this is a Xapian limit */ doc.add_term (std::string (prefix + value, 0, MU_STORE_MAX_TERM_LENGTH)); + /* add a normalized version as well (accents removed, lowercase) */ + std::string norm(mu_msg_str_normalize(str, TRUE)); + doc.add_term (std::string (prefix + norm, 0, + MU_STORE_MAX_TERM_LENGTH)); + } + if (mu_msg_field_xapian_value(field)) doc.add_value ((Xapian::valueno)mu_msg_field_id (field), value);