From c703745bcd09af545ef1bd320c895778081488d2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 20 Aug 2020 20:24:49 +0000 Subject: searchview: use over.sqlite3 instead of Xapian docdata This is a step towards improving kernel page cache hit rates by relying on over.sqlite3 for document data instead of Xapian. Some micro-optimization to over->get_art was required to maintain performance. --- lib/PublicInbox/SearchView.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 28d9ce5d..61534c25 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -13,6 +13,7 @@ use PublicInbox::WwwAtomStream; use PublicInbox::WwwStream qw(html_oneshot); use PublicInbox::SearchThread; use PublicInbox::SearchQuery; +use PublicInbox::Search qw(mdocid); my %rmap_inc; sub mbox_results { @@ -90,19 +91,22 @@ sub mset_summary { my $pfx = ' ' x $pad; my $res = \($ctx->{-html_tip}); my $ibx = $ctx->{-inbox}; - my $srch = $ibx->search; + my $over = $ibx->over; + my $nshard = $ibx->search->{nshard} // 1; my $obfs_ibx = $ibx->{obfuscate} ? $ibx : undef; foreach my $m ($mset->items) { my $rank = sprintf("%${pad}d", $m->get_rank + 1); my $pct = get_pct($m); - my $smsg = PublicInbox::Smsg::from_mitem($m, $srch); + my $num = mdocid($nshard, $m); + my $smsg = $over->get_art($num, 1); unless ($smsg) { eval { - $m = "$m ".$m->get_docid . " expired\n"; + $m = "$m $num expired\n"; $ctx->{env}->{'psgi.errors'}->print($m); }; next; } + PublicInbox::Smsg::psgi_cull($smsg); my $s = ascii_html($smsg->{subject}); my $f = ascii_html($smsg->{from_name}); if ($obfs_ibx) { -- cgit v1.2.3-24-ge0c7