]> Sergey Matveev's repositories - public-inbox.git/commitdiff
imap: *SEARCH: reinstate "TEXT" search-key
authorEric Wong <e@yhbt.net>
Tue, 16 Jun 2020 07:05:06 +0000 (07:05 +0000)
committerEric Wong <e@yhbt.net>
Tue, 16 Jun 2020 21:41:59 +0000 (21:41 +0000)
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
t/imapd.t

index c9b442cb4fa8dc1d6bd50606e1d93aca5461467f..4ea99ea500bc61988b45f15c4d12e896489fb387 100644 (file)
@@ -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 }
 
index 4e2c89318703afd1edb4f46f74672fcfd2d64264..f9d93448fe570152ad05ffdec20b15c4d614080d 100644 (file)
--- 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