From: David Bremner Date: Sun, 30 Sep 2018 16:27:55 +0000 (-0300) Subject: lib: use phrase search for anything not ending in '*' X-Git-Tag: archive/debian/0.29_rc0-1~119 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=d25dcc589ce4c1a87d698c6aef1ce3e38e4a50bb lib: use phrase search for anything not ending in '*' Anything that does not look like a wildcard should be safe to quote. This should fix the problem searching for xapian keywords. --- diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index f50da9a3..5d4cf80a 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -194,7 +194,7 @@ RegexpFieldProcessor::operator() (const std::string & str) * phrase parsing, when possible */ std::string query_str; - if (str.find (' ') != std::string::npos) + if (*str.rbegin () != '*' || str.find (' ') != std::string::npos) query_str = '"' + str + '"'; else query_str = str; diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh index e792decf..92334ba0 100755 --- a/test/T650-regexp-query.sh +++ b/test/T650-regexp-query.sh @@ -81,12 +81,10 @@ add_message '[from]="and"' '[subject]="and-and-and"' printf "id:$gen_msg_id\n" > EXPECTED test_begin_subtest "quoted xapian keyword search for from:" -test_subtest_known_broken notmuch search --output=messages 'from:"and"' > OUTPUT test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "quoted xapian keyword search for subject:" -test_subtest_known_broken notmuch search --output=messages 'subject:"and-and-and"' > OUTPUT test_expect_equal_file EXPECTED OUTPUT