diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-06 21:44:38 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-06 21:45:03 +0000 |
commit | fad9acd35e56a289ade90a62d056b2a6663d448c (patch) | |
tree | 74d3203af13690a521d4de54ca2733223e2c389e /t/search.t | |
parent | 8f2999546c9447ce2aed48ba4d1192e0058e28a2 (diff) | |
download | public-inbox-fad9acd35e56a289ade90a62d056b2a6663d448c.tar.gz |
Favor simpler internal APIs this time around, this cuts a fair amount of code out and takes another step towards removing Xapian as a dependency for v2 repos.
Diffstat (limited to 't/search.t')
-rw-r--r-- | t/search.t | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -89,10 +89,9 @@ sub filter_mids { { $rw_commit->(); $ro->reopen; - my $found = $ro->first_smsg_by_mid('root@s'); - ok($found, "message found"); - is($root_id, $found->{doc_id}, 'doc_id set correctly'); - is($found->mid, 'root@s', 'mid set correctly'); + my $found = $ro->query('m:root@s'); + is(scalar(@$found), 1, "message found"); + is($found->[0]->mid, 'root@s', 'mid set correctly'); my ($res, @res); my @exp = sort qw(root@s last@s); @@ -276,10 +275,9 @@ sub filter_mids { ], body => "LOOP!\n")); ok($doc_id > 0, "doc_id defined with circular reference"); - my $smsg = $rw->first_smsg_by_mid('circle@a'); + my $smsg = $rw->query('m:circle@a', {limit=>1})->[0]; is($smsg->references, '', "no references created"); - my $msg = PublicInbox::SearchMsg->load_doc($smsg->{doc}); - is($s, $msg->subject, 'long subject not rewritten'); + is($s, $smsg->subject, 'long subject not rewritten'); } { @@ -293,9 +291,7 @@ sub filter_mids { my $mime = Email::MIME->new($str); my $doc_id = $rw->add_message($mime); ok($doc_id > 0, 'message indexed doc_id with UTF-8'); - my $smsg = $rw->first_smsg_by_mid('testmessage@example.com'); - my $msg = PublicInbox::SearchMsg->load_doc($smsg->{doc}); - + my $msg = $rw->query('m:testmessage@example.com', {limit => 1})->[0]; is($mime->header('Subject'), $msg->subject, 'UTF-8 subject preserved'); } |