]> git.notmuchmail.org Git - notmuch/commitdiff
lib: use phrase search for anything not ending in '*'
authorDavid Bremner <david@tethera.net>
Sun, 30 Sep 2018 16:27:55 +0000 (13:27 -0300)
committerDavid Bremner <david@tethera.net>
Thu, 28 Mar 2019 17:34:37 +0000 (14:34 -0300)
Anything that does not look like a wildcard should be safe to
quote. This should fix the problem searching for xapian keywords.

lib/regexp-fields.cc
test/T650-regexp-query.sh

index f50da9a3c99baa9841ddb6e1912cff3bc190dbdb..5d4cf80aeea6f145630002c45ac31c4bda5f526c 100644 (file)
@@ -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;
index e792decf4e1657c08edb45a4d6bbea3b2d2c132d..92334ba0d78f1e8ed789672d8535de7c602f3f99 100755 (executable)
@@ -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