* mu-str.c, test-mu-query.c: ensure all unit tests pass

This commit is contained in:
djcb 2012-04-13 22:12:44 +03:00
parent 3ba8919faf
commit c3f63bb4c0
2 changed files with 7 additions and 5 deletions

View File

@ -428,12 +428,13 @@ mu_str_ascii_xapian_escape_in_place (char *term, gboolean esc_space)
gchar *cur;
const char escchar = '_';
gboolean is_field, is_range_field;
unsigned colon;
g_return_val_if_fail (term, NULL);
check_for_field (term, &is_field, &is_range_field);
for (cur = term; *cur; ++cur) {
for (colon = 0, cur = term; *cur; ++cur) {
*cur = tolower(*cur);
@ -448,11 +449,13 @@ mu_str_ascii_xapian_escape_in_place (char *term, gboolean esc_space)
break;
case ':':
/* if there's a registered xapian prefix
* before the ':', don't touch it. Otherwise
* replace ':' with '_'... ugh yuck ugly...
* before the *first* ':', don't touch
* it. Otherwise replace ':' with '_'... ugh
* yuck ugly...
*/
if (!is_field)
if (colon != 0 || !is_field)
*cur = escchar;
++colon;
break;
case '\'':
case '*': /* wildcard */

View File

@ -488,7 +488,6 @@ test_mu_query_attach (void)
QResults queries[] = {
{ "j:sittingbull.jpg", 1},
{ "'file:sitting*'", 1},
{ "file:custer", 0},
{ "file:custer.jpg", 1}
};