]> Sergey Matveev's repositories - public-inbox.git/commitdiff
search: s/count/total/ for results
authorEric Wong <e@80x24.org>
Fri, 21 Aug 2015 23:43:12 +0000 (23:43 +0000)
committerEric Wong <e@80x24.org>
Fri, 21 Aug 2015 23:43:12 +0000 (23:43 +0000)
This is hopefully less ambiguous, as the word "count" confused
me, too.

lib/PublicInbox/Search.pm
lib/PublicInbox/View.pm
t/search.t

index f1ff3a4b79fa6ea8c05f0c3a104c69424aa05c68..580b79fc5044707ca905f45424767868fe5ab81a 100644 (file)
@@ -242,7 +242,7 @@ sub get_thread {
        my ($self, $mid, $opts) = @_;
        my $smsg = eval { $self->lookup_message($mid) };
 
-       return { count => 0, msgs => [] } unless $smsg;
+       return { total => 0, msgs => [] } unless $smsg;
        my $qp = $self->qp;
        my $qtid = $qp->parse_query('thread:'.$smsg->thread_id);
        my $qsub = $qp->parse_query('path:'.mid_compressed($smsg->path));
@@ -267,7 +267,7 @@ sub do_enquire {
                PublicInbox::SearchMsg->load_doc($_->get_document);
        } $mset->items;
 
-       { count => $mset->get_matches_estimated, msgs => \@msgs }
+       { total => $mset->get_matches_estimated, msgs => \@msgs }
 }
 
 # read-write
index 4ed5344e585084c9c94dc3478c0867c01e6750d9..8105affecffa7fa8412b8c0f8013ce18e14de0d2 100644 (file)
@@ -438,7 +438,7 @@ sub html_footer {
                $idx = " <a\nhref=\"../t/$mid.html$t_anchor\">".
                       "threadlink</a>$idx";
                my $res = $srch->get_followups($mid);
-               if (my $c = $res->{count}) {
+               if (my $c = $res->{total}) {
                        $c = $c == 1 ? '1 followup' : "$c followups";
                        $idx .= "\n$c:\n";
                        $res->{srch} = $srch;
index 55abe9e8bdd083d10105168731ae96f56aabcc55..89a2862951b87dbebe5d3f4f88fd2e97d65c0aae 100644 (file)
@@ -73,7 +73,7 @@ sub filter_mids {
 
        foreach my $p (qw(hello hello_ hello_world2 hello_world_)) {
                $res = $ro->query("path:$p");
-               is($res->{count}, 0, "path variant `$p' does not match");
+               is($res->{total}, 0, "path variant `$p' does not match");
        }
 
        $res = $ro->query('subject:(Hello world)');
@@ -100,7 +100,7 @@ sub filter_mids {
                is_deeply(\@res, [ 'last@s' ],
                          "got expected results for $f: match");
                $res = $ro->query($f . ':root');
-               is($res->{count}, 0, "no partial mid match");
+               is($res->{total}, 0, "no partial mid match");
        }
 }
 
@@ -204,7 +204,7 @@ sub filter_mids {
        $rw_commit->();
        $ro->reopen;
        my $t = $ro->get_thread('root@s');
-       is($t->{count}, 4, "got all 4 mesages in thread");
+       is($t->{total}, 4, "got all 4 mesages in thread");
        my @exp = sort($long_reply_mid, 'root@s', 'last@s', $long_midc);
        @res = filter_mids($t);
        is_deeply(\@res, \@exp, "get_thread works");
@@ -233,12 +233,12 @@ sub filter_mids {
                ],
                body => "theatre\nfade\n"));
        my $res = $rw->query("theatre");
-       is($res->{count}, 2, "got both matches");
+       is($res->{total}, 2, "got both matches");
        is($res->{msgs}->[0]->mid, 'nquote@a', "non-quoted scores higher");
        is($res->{msgs}->[1]->mid, 'quote@a', "quoted result still returned");
 
        $res = $rw->query("illusions");
-       is($res->{count}, 1, "got a match for quoted text");
+       is($res->{total}, 1, "got a match for quoted text");
        is($res->{msgs}->[0]->mid, 'quote@a',
                "quoted result returned if nothing else");
 }