From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS20860 88.150.156.0/22 X-Spam-Status: No, score=-0.4 required=3.0 tests=AWL,BAYES_00, RCVD_IN_BRBL_LASTEXT,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL, RDNS_NONE,SPF_FAIL,SPF_HELO_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (unknown [88.150.157.14]) by dcvr.yhbt.net (Postfix) with ESMTP id 4E55E2070F for ; Thu, 8 Sep 2016 01:53:17 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH 2/6] search: drop longer subject: prefix for search Date: Thu, 8 Sep 2016 01:53:06 +0000 Message-Id: <20160908015310.28670-2-e@80x24.org> In-Reply-To: <20160908015310.28670-1-e@80x24.org> References: <20160908015310.28670-1-e@80x24.org> List-Id: We only document the "s:" anyways. While the long name is more descriptive, the ambiguity makes agnostic caching (by Varnish or similar) slightly harder and longer URLs are more likely to be accidentally truncated when shared. --- lib/PublicInbox/Search.pm | 1 - t/search.t | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index aec459b..3b25b66 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -58,7 +58,6 @@ my %bool_pfx_external = ( ); my %prob_prefix = ( - subject => 'S', s => 'S', # for mairix compatibility m => 'Q', # 'mid' is exact, 'm' can do partial f => 'A', # for mairix compatibility diff --git a/t/search.t b/t/search.t index bb0861a..7abaf83 100644 --- a/t/search.t +++ b/t/search.t @@ -123,19 +123,19 @@ sub filter_mids { is($res->{total}, 0, "path variant `$p' does not match"); } - $res = $ro->query('subject:(Hello world)'); + $res = $ro->query('s:(Hello world)'); @res = filter_mids($res); - is_deeply(\@res, \@exp, 'got expected results for subject:() match'); + is_deeply(\@res, \@exp, 'got expected results for s:() match'); - $res = $ro->query('subject:"Hello world"'); + $res = $ro->query('s:"Hello world"'); @res = filter_mids($res); - is_deeply(\@res, \@exp, 'got expected results for subject:"" match'); + is_deeply(\@res, \@exp, 'got expected results for s:"" match'); - $res = $ro->query('subject:"Hello world"', {limit => 1}); + $res = $ro->query('s:"Hello world"', {limit => 1}); is(scalar @{$res->{msgs}}, 1, "limit works"); my $first = $res->{msgs}->[0]; - $res = $ro->query('subject:"Hello world"', {offset => 1}); + $res = $ro->query('s:"Hello world"', {offset => 1}); is(scalar @{$res->{msgs}}, 1, "offset works"); my $second = $res->{msgs}->[0]; @@ -181,7 +181,7 @@ sub filter_mids { $rw_commit->(); $ro->reopen; - # Subject: + # subject my $res = $ro->query('ghost'); my @exp = sort qw(ghost-message@s ghost-reply@s); my @res = filter_mids($res); -- EW