diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 8e740a81..9dcf9732 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -158,8 +158,14 @@ RegexpFieldProcessor::operator() (const std::string & str) } else { /* TODO replace this with a nicer API level triggering of * phrase parsing, when possible */ - std::string quoted='"' + str + '"'; - return parser.parse_query (quoted, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix); + std::string query_str; + + if (str.find (' ') != std::string::npos) + query_str = '"' + str + '"'; + else + query_str = str; + + return parser.parse_query (query_str, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix); } } #endif diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh index 1db6a76b..61739e87 100755 --- a/test/T650-regexp-query.sh +++ b/test/T650-regexp-query.sh @@ -12,12 +12,10 @@ fi notmuch search --output=messages from:cworth > cworth.msg-ids test_begin_subtest "xapian wildcard search for from:" -test_subtest_known_broken notmuch search --output=messages 'from:cwo*' > OUTPUT test_expect_equal_file cworth.msg-ids OUTPUT test_begin_subtest "xapian wildcard search for subject:" -test_subtest_known_broken test_expect_equal $(notmuch count 'subject:count*') 1 test_begin_subtest "regexp from search, case sensitive"