X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=lib%2Fregexp-fields.cc;h=539915d892f9529d3d011dfa7611bb37aba718d2;hb=HEAD;hp=7e9d959c9b0bc15ffc5b10a9754246750384e668;hpb=c62c22c9fb222d43d9b9956ce6b6e9985019ea2d;p=notmuch diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 7e9d959c..3a775261 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -25,6 +25,7 @@ #include "regexp-fields.h" #include "notmuch-private.h" #include "database-private.h" +#include "xapian-extra.h" notmuch_status_t compile_regex (regex_t ®exp, const char *str, std::string &msg) @@ -200,7 +201,7 @@ RegexpFieldProcessor::operator() (const std::string & str) if (str.empty ()) { if (options & NOTMUCH_FIELD_PROBABILISTIC) { return Xapian::Query (Xapian::Query::OP_AND_NOT, - Xapian::Query::MatchAll, + xapian_query_match_all (), Xapian::Query (Xapian::Query::OP_WILDCARD, term_prefix)); } else { return Xapian::Query (term_prefix); @@ -227,7 +228,8 @@ RegexpFieldProcessor::operator() (const std::string & str) * phrase parsing, when possible */ std::string query_str; - if (*str.rbegin () != '*' || str.find (' ') != std::string::npos) + if ((str.at (0) != '(' || *str.rbegin () != ')') && + (*str.rbegin () != '*' || str.find (' ') != std::string::npos)) query_str = '"' + str + '"'; else query_str = str;