X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FExtSearch.pm;h=fa49a1d0182f75d53e4408d26fdc4f2997f6ef6e;hb=refs%2Fheads%2Fmaster;hp=bd301158a6b0a4163cb58073384bf034a5238dda;hpb=4363e6037fa7d597294186f60373e9de8e1b3d74;p=public-inbox.git
diff --git a/lib/PublicInbox/ExtSearch.pm b/lib/PublicInbox/ExtSearch.pm
index bd301158..fa49a1d0 100644
--- a/lib/PublicInbox/ExtSearch.pm
+++ b/lib/PublicInbox/ExtSearch.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2021 all contributors
+# Copyright (C) all contributors
# License: AGPL-3.0+
# Read-only external (detached) index for cross inbox search.
@@ -33,12 +33,18 @@ sub misc {
# same as per-inbox ->over, for now...
sub over {
my ($self) = @_;
- $self->{over} //= PublicInbox::Over->new("$self->{xpfx}/over.sqlite3");
+ $self->{over} //= do {
+ PublicInbox::Inbox::_cleanup_later($self);
+ PublicInbox::Over->new("$self->{xpfx}/over.sqlite3");
+ };
}
sub git {
my ($self) = @_;
- $self->{git} //= PublicInbox::Git->new("$self->{topdir}/ALL.git");
+ $self->{git} //= do {
+ PublicInbox::Inbox::_cleanup_later($self);
+ PublicInbox::Git->new("$self->{topdir}/ALL.git");
+ };
}
# returns a hashref of { $NEWSGROUP_NAME => $ART_NO } using the `xref3' table
@@ -58,7 +64,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});
@@ -102,19 +108,25 @@ 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';
}
+sub search {
+ PublicInbox::Inbox::_cleanup_later($_[0]);
+ $_[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 = \&PublicInbox::Search::reopen;
+*isrch = \&search;
1;