From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] lib: use phrase search for anything not ending in '*'
Date: Sun, 30 Sep 2018 13:27:55 -0300 [thread overview]
Message-ID: <20180930162755.10856-2-david@tethera.net> (raw)
In-Reply-To: <20180930162755.10856-1-david@tethera.net>
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 | 2 +-
test/T650-regexp-query.sh | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc
index 084bc8c0..52f30d82 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 7448c024..181e3856 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
--
2.19.0
next prev parent reply other threads:[~2018-09-30 16:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-30 16:27 [PATCH 1/2] test: add two known broken tests searching for xapian keywords David Bremner
2018-09-30 16:27 ` David Bremner [this message]
2019-03-28 17:43 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180930162755.10856-2-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).