From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 351541FB00 for ; Tue, 6 Mar 2018 08:42:44 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 29/34] search: each_smsg_by_mid uses skeleton if available Date: Tue, 6 Mar 2018 08:42:37 +0000 Message-Id: <20180306084242.19988-30-e@80x24.org> In-Reply-To: <20180306084242.19988-1-e@80x24.org> References: <20180306084242.19988-1-e@80x24.org> List-Id: We do not need the large DBs for MID scans. --- lib/PublicInbox/Search.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index dc46ead..7cad31a 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -409,13 +409,15 @@ sub lookup_article { sub each_smsg_by_mid { my ($self, $mid, $cb) = @_; - my $xdb = $self->{xdb}; # XXX retry_reopen isn't necessary for V2Writable, but the PSGI # interface will need it... - my ($head, $tail) = $self->find_doc_ids('Q' . $mid); + my $db = $self->{skel} || $self->{xdb}; + my $term = 'Q' . $mid; + my $head = $db->postlist_begin($term); + my $tail = $db->postlist_end($term); for (; $head->nequal($tail); $head->inc) { my $doc_id = $head->get_docid; - my $doc = $xdb->get_document($doc_id); + my $doc = $db->get_document($doc_id); my $smsg = PublicInbox::SearchMsg->wrap($doc, $mid); $smsg->{doc_id} = $doc_id; $cb->($smsg) or return; -- EW