* updates for new mu_str escaping function, better error handling

This commit is contained in:
djcb
2012-03-30 19:02:46 +03:00
parent 2a105f1612
commit e7e84ed08a
3 changed files with 15 additions and 7 deletions

View File

@ -194,7 +194,10 @@ get_query (MuQuery *mqx, const char* searchexpr, GError **err)
Xapian::Query query;
char *preprocessed;
preprocessed = mu_query_preprocess (searchexpr);
preprocessed = mu_query_preprocess (searchexpr, err);
if (!preprocessed)
throw std::runtime_error
("parse error while preprocessing query");
try {
query = mqx->query_parser().parse_query
@ -278,7 +281,7 @@ mu_query_destroy (MuQuery *self)
/* preprocess a query to make them a bit more promiscuous */
char*
mu_query_preprocess (const char *query)
mu_query_preprocess (const char *query, GError **err)
{
GSList *parts, *cur;
gchar *myquery;
@ -287,7 +290,9 @@ mu_query_preprocess (const char *query)
/* convert the query to a list of query terms, and escape them
* separately */
parts = mu_str_esc_to_list (query);
parts = mu_str_esc_to_list (query, err);
if (!parts)
return NULL;
for (cur = parts; cur; cur = g_slist_next(cur)) {
/* remove accents and turn to lower-case */