mirror of https://github.com/djcb/mu.git
* mu-str.c, test-mu-query.c: ensure all unit tests pass
This commit is contained in:
parent
3ba8919faf
commit
c3f63bb4c0
11
src/mu-str.c
11
src/mu-str.c
|
@ -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 */
|
||||
|
|
|
@ -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}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue