* mu-query.cc: now always search for normalized, lower-case values
This commit is contained in:
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "mu-util.h"
|
#include "mu-util.h"
|
||||||
#include "mu-util-db.h"
|
#include "mu-util-db.h"
|
||||||
|
#include "mu-msg-str.h"
|
||||||
|
|
||||||
static void add_prefix (const MuMsgField* field,
|
static void add_prefix (const MuMsgField* field,
|
||||||
Xapian::QueryParser* qparser);
|
Xapian::QueryParser* qparser);
|
||||||
@ -246,7 +246,7 @@ mu_query_preprocess (const char *query)
|
|||||||
* will fixes some of the false-negatives. A full fix
|
* will fixes some of the false-negatives. A full fix
|
||||||
* probably requires some custom query parser.
|
* probably requires some custom query parser.
|
||||||
*/
|
*/
|
||||||
my_query = g_utf8_strdown (query, -1);
|
my_query = mu_msg_str_normalize(query, TRUE);
|
||||||
|
|
||||||
for (cur = my_query; *cur; ++cur) {
|
for (cur = my_query; *cur; ++cur) {
|
||||||
if (*cur == ':') /* we found a ':' */
|
if (*cur == ':') /* we found a ':' */
|
||||||
@ -254,8 +254,8 @@ mu_query_preprocess (const char *query)
|
|||||||
* ':', don't touch it. Otherwise replace ':' with
|
* ':', don't touch it. Otherwise replace ':' with
|
||||||
* a space'... ugly...
|
* a space'... ugly...
|
||||||
*/
|
*/
|
||||||
if (!is_xapian_prefix (my_query, cur))
|
if (!is_xapian_prefix (my_query, cur))
|
||||||
*cur = ' ';
|
*cur = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return my_query;
|
return my_query;
|
||||||
@ -273,9 +273,9 @@ mu_query_run (MuQuery *self, const char* searchexpr,
|
|||||||
try {
|
try {
|
||||||
char *preprocessed;
|
char *preprocessed;
|
||||||
int err (0);
|
int err (0);
|
||||||
|
|
||||||
preprocessed = mu_query_preprocess (searchexpr);
|
|
||||||
|
|
||||||
|
preprocessed = mu_query_preprocess (searchexpr);
|
||||||
|
|
||||||
Xapian::Query q(get_query(self, preprocessed, &err));
|
Xapian::Query q(get_query(self, preprocessed, &err));
|
||||||
if (err) {
|
if (err) {
|
||||||
g_warning ("Error in query '%s'", preprocessed);
|
g_warning ("Error in query '%s'", preprocessed);
|
||||||
|
|||||||
Reference in New Issue
Block a user