diff options
Diffstat (limited to 'lib/PublicInbox/ExtSearch.pm')
-rw-r--r-- | lib/PublicInbox/ExtSearch.pm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/PublicInbox/ExtSearch.pm b/lib/PublicInbox/ExtSearch.pm index 7520e71c..d43c23e6 100644 --- a/lib/PublicInbox/ExtSearch.pm +++ b/lib/PublicInbox/ExtSearch.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org> +# Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> # Read-only external (detached) index for cross inbox search. @@ -33,9 +33,11 @@ sub misc { # same as per-inbox ->over, for now... sub over { my ($self) = @_; - $self->{over} //= do { + $self->{over} // eval { PublicInbox::Inbox::_cleanup_later($self); - PublicInbox::Over->new("$self->{xpfx}/over.sqlite3"); + my $over = PublicInbox::Over->new("$self->{xpfx}/over.sqlite3"); + $over->dbh; # may die + $self->{over} = $over; }; } @@ -64,7 +66,7 @@ SELECT ibx_id FROM inboxes WHERE eidx_key = ? LIMIT 1 $sth = $dbh->prepare_cached(<<'', undef, 1); SELECT docid FROM xref3 WHERE oidbin = ? AND xnum = ? AND ibx_id = ? LIMIT 1 - $sth->bind_param(1, pack('H*', $xsmsg->{blob}), SQL_BLOB); + $sth->bind_param(1, $xsmsg->oidbin, SQL_BLOB); # NNTP::cmd_over can set {num} to zero according to RFC 3977 8.3.2 $sth->bind_param(2, $xsmsg->{num} || $xsmsg->{-orig_num}); @@ -108,7 +110,7 @@ sub altid_map { {} } sub description { my ($self) = @_; ($self->{description} //= - PublicInbox::Inbox::cat_desc("$self->{topdir}/description")) // + PublicInbox::Git::cat_desc("$self->{topdir}/description")) // '$EXTINDEX_DIR/description missing'; } @@ -117,13 +119,14 @@ sub search { $_[0]; } +sub thing_type { 'external index' } + no warnings 'once'; *base_url = \&PublicInbox::Inbox::base_url; *smsg_eml = \&PublicInbox::Inbox::smsg_eml; *smsg_by_mid = \&PublicInbox::Inbox::smsg_by_mid; *msg_by_mid = \&PublicInbox::Inbox::msg_by_mid; *modified = \&PublicInbox::Inbox::modified; -*recent = \&PublicInbox::Inbox::recent; *max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef *isrch = \&search; |