From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 4/2] imap: *SEARCH: reinstate "TEXT" search-key
Date: Tue, 16 Jun 2020 07:05:06 +0000 [thread overview]
Message-ID: <20200616070506.GB24682@dcvr> (raw)
In-Reply-To: <20200616050540.13357-1-e@yhbt.net>
I accidentally dropped "TEXT" handling while porting
the IMAP search query parser to Parse::RecDescent.
This reinstates it and adds a test to prevent future
regression, and the additional test fixes a counting
error for non-Xapian-enabled systems.
---
lib/PublicInbox/IMAPsearchqp.pm | 3 ++-
t/imapd.t | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/IMAPsearchqp.pm b/lib/PublicInbox/IMAPsearchqp.pm
index c9b442cb4fa..4ea99ea500b 100644
--- a/lib/PublicInbox/IMAPsearchqp.pm
+++ b/lib/PublicInbox/IMAPsearchqp.pm
@@ -16,7 +16,6 @@ my %MM = map {; $MoY[$_-1] => sprintf('%02u', $_) } (1..12);
# IMAP to Xapian header search key mapping
my %IH2X = (
- TEXT => '',
SUBJECT => 's:',
BODY => 'b:',
FROM => 'f:',
@@ -183,6 +182,7 @@ search_key1 : "ALL" | "RECENT" | "UNSEEN" | "NEW"
| CC_string
| BCC_string
| SUBJECT_string
+ | TEXT_string
| UID_set
| MSN_set
| sub_query
@@ -239,6 +239,7 @@ TO_string : "TO" string { $q->ih2x('TO', $item{string}) }
CC_string : "CC" string { $q->ih2x('CC', $item{string}) }
BCC_string : "BCC" string { $q->ih2x('BCC', $item{string}) }
SUBJECT_string : "SUBJECT" string { $q->ih2x('SUBJECT', $item{string}) }
+TEXT_string : "TEXT" string { $q->ih2x(undef, $item{string}) }
op_subq_enter : '(' { $q->subq_enter }
sub_query : op_subq_enter search_key1(s) ')' { $q->subq_leave }
diff --git a/t/imapd.t b/t/imapd.t
index 4e2c8931870..f9d93448fe5 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -398,6 +398,8 @@ SKIP: {
is(scalar(@$x), 1, 'MSN SEARCH on Subject works after rm');
$x = $mic->message_string($x->[0]);
is($x, $ret->{2}->{RFC822}, 'message 2 unchanged');
+ $x = $mic->search(qw(text embedded));
+ is(scalar(@$x), 1, 'MSN SEARCH on TEXT works after rm');
}
# FIXME? no EXPUNGE response, yet
prev parent reply other threads:[~2020-06-16 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 5:05 [PATCH 0/2] imap: search improvements Eric Wong
2020-06-16 5:05 ` [PATCH 1/2] imap: reinstate non-UID SEARCH Eric Wong
2020-06-16 5:05 ` [PATCH 2/2] imap: *SEARCH: use Parse::RecDescent Eric Wong
2020-06-16 7:04 ` [PATCH 3/2] imap: *SEARCH: fix CHARSET handling Eric Wong
2020-06-16 7:05 ` Eric Wong [this message]
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://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200616070506.GB24682@dcvr \
--to=e@yhbt.net \
--cc=meta@public-inbox.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://80x24.org/public-inbox.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).