mirror of https://github.com/djcb/mu.git
* support special characters in X-Labels
This commit is contained in:
parent
31d568e076
commit
f59ca5af2d
|
@ -212,7 +212,7 @@ static const MuMsgField FIELD_DATA[] = {
|
|||
MU_MSG_FIELD_TYPE_STRING_LIST,
|
||||
"tag", 'x', 'X',
|
||||
FLAG_GMIME | FLAG_XAPIAN_TERM | FLAG_XAPIAN_PREFIX_ONLY |
|
||||
FLAG_NORMALIZE
|
||||
FLAG_NORMALIZE | FLAG_XAPIAN_ESCAPE
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -407,6 +407,9 @@ add_terms_values_string_list (Xapian::Document& doc, MuMsg *msg,
|
|||
|
||||
if (mu_msg_field_normalize (mfid))
|
||||
mu_str_normalize_in_place (val, TRUE);
|
||||
|
||||
if (mu_msg_field_xapian_escape (mfid))
|
||||
mu_str_ascii_xapian_escape_in_place (val);
|
||||
|
||||
doc.add_term (prefix(mfid) +
|
||||
std::string(val, 0, MU_STORE_MAX_TERM_LENGTH));
|
||||
|
|
|
@ -87,7 +87,6 @@ run_and_count_matches (const char *xpath, const char *query)
|
|||
MuQuery *mquery;
|
||||
MuMsgIter *iter;
|
||||
guint count1, count2;
|
||||
GHashTable *hash;
|
||||
|
||||
mquery = mu_query_new (xpath, NULL);
|
||||
g_assert (query);
|
||||
|
@ -107,9 +106,6 @@ run_and_count_matches (const char *xpath, const char *query)
|
|||
mu_query_destroy (mquery);
|
||||
g_assert (iter);
|
||||
|
||||
hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify)g_free, NULL);
|
||||
|
||||
assert_no_dups (iter);
|
||||
|
||||
/* run query twice, to test mu_msg_iter_reset */
|
||||
|
@ -414,7 +410,7 @@ test_mu_query_attach (void)
|
|||
|
||||
/* g_print ("(%s)\n", xpath); */
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||
g_assert_cmpuint (run_and_count_matches (xpath, queries[i].query),
|
||||
==, queries[i].count);
|
||||
|
||||
|
@ -450,6 +446,36 @@ test_mu_query_tags (void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
test_mu_query_tags_02 (void)
|
||||
{
|
||||
gchar *xpath;
|
||||
int i;
|
||||
|
||||
QResults queries[] = {
|
||||
{ "x:paradise", 1},
|
||||
{ "tag:@NextActions", 1},
|
||||
{ "x:queensrÿche", 1},
|
||||
{ "tag:lost OR tag:operation:mindcrime", 2},
|
||||
};
|
||||
|
||||
xpath = fill_database (MU_TESTMAILDIR2);
|
||||
g_assert (xpath != NULL);
|
||||
|
||||
/* g_print ("(%s)\n", xpath); */
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i) {
|
||||
/* g_print ("%s\n", queries[i].query); */
|
||||
g_assert_cmpuint (run_and_count_matches (xpath, queries[i].query),
|
||||
==, queries[i].count);
|
||||
}
|
||||
|
||||
g_free (xpath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
@ -474,6 +500,8 @@ main (int argc, char *argv[])
|
|||
test_mu_query_attach);
|
||||
g_test_add_func ("/mu-query/test-mu-query-tags",
|
||||
test_mu_query_tags);
|
||||
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
||||
test_mu_query_tags_02);
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
|
|
Loading…
Reference in New Issue