* [PATCH 1/2] test: add two known broken tests searching for xapian keywords
@ 2018-09-30 16:27 David Bremner
2018-09-30 16:27 ` [PATCH 2/2] lib: use phrase search for anything not ending in '*' David Bremner
2019-03-28 17:43 ` [PATCH 1/2] test: add two known broken tests searching for xapian keywords David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2018-09-30 16:27 UTC (permalink / raw)
To: notmuch
Thanks to plujon for pointing out this problem on IRC. The underlying
issue is that the quotes are stripped before the field processors get
the query string, and the heuristic for putting them back is not quite
right.
---
test/T650-regexp-query.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh
index 4085340f..7448c024 100755
--- a/test/T650-regexp-query.sh
+++ b/test/T650-regexp-query.sh
@@ -77,6 +77,19 @@ test_expect_equal_file cworth.msg-ids OUTPUT
test_begin_subtest "xapian wildcard search for subject:"
test_expect_equal $(notmuch count 'subject:count*') 1
+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
+
test_begin_subtest "regexp from search, case sensitive"
notmuch search --output=messages from:/carl/ > OUTPUT
test_expect_equal_file /dev/null OUTPUT
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] lib: use phrase search for anything not ending in '*'
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
2019-03-28 17:43 ` [PATCH 1/2] test: add two known broken tests searching for xapian keywords David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2018-09-30 16:27 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] test: add two known broken tests searching for xapian keywords
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 ` [PATCH 2/2] lib: use phrase search for anything not ending in '*' David Bremner
@ 2019-03-28 17:43 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2019-03-28 17:43 UTC (permalink / raw)
To: notmuch
David Bremner <david@tethera.net> writes:
> Thanks to plujon for pointing out this problem on IRC. The underlying
> issue is that the quotes are stripped before the field processors get
> the query string, and the heuristic for putting them back is not quite
> right.
> ---
Series pushed. Let me know if it breaks something.
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-28 17:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] lib: use phrase search for anything not ending in '*' David Bremner
2019-03-28 17:43 ` [PATCH 1/2] test: add two known broken tests searching for xapian keywords David Bremner
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).