From 5d5789076ed4da7502ff18748d1553c899b78907 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 15 Feb 2020 09:46:37 +0000 Subject: view,searchview: avoid smsg method calls when using SQLite/Xapian We already pre-populate the hashref when loading $smsg (PublicInbox::SearchMsg) objects out of over.sqlite3 or Xapian, so making expensive method calls isn't necessary in those cases. We only need to use the method calls when SQLite or Xapian are not available or are being populated (such as during indexing). --- lib/PublicInbox/SearchView.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 828926c7..7e508bb7 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -108,14 +108,14 @@ sub mset_summary { }; next; } - my $s = ascii_html($smsg->subject); - my $f = ascii_html($smsg->from_name); + my $s = ascii_html($smsg->{subject}); + my $f = ascii_html($smsg->{from_name}); if ($obfs_ibx) { obfuscate_addrs($obfs_ibx, $s); obfuscate_addrs($obfs_ibx, $f); } - my $date = PublicInbox::View::fmt_ts($smsg->ds); - my $mid = PublicInbox::Hval->new_msgid($smsg->mid)->{href}; + my $date = PublicInbox::View::fmt_ts($smsg->{ds}); + my $mid = PublicInbox::Hval->new_msgid($smsg->{mid})->{href}; $s = '(no subject)' if $s eq ''; $$res .= qq{$rank. }. $s . "\n"; -- cgit v1.2.3-24-ge0c7