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 2EC9A20401; Thu, 15 Jun 2017 23:11:59 +0000 (UTC) Date: Thu, 15 Jun 2017 23:11:59 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/3] searchidx: remove messages correctly from Xapian index Message-ID: <20170615231159.GA15196@dcvr> References: <20170614001448.27098-1-e@80x24.org> <20170614001448.27098-2-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170614001448.27098-2-e@80x24.org> List-Id: This fixes a bug introduced in commit 7eeadcb62729b0efbcb53cd9b7b181897c92cf9a ("search: remove unnecessary abstractions and functionality") --- lib/PublicInbox/SearchIdx.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 9ba9437..69b7a6f 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -366,8 +366,12 @@ sub remove_message { $mid = mid_clean($mid); eval { - $doc_id = $self->find_unique_doc_id('mid', $mid); - $db->delete_document($doc_id) if defined $doc_id; + $doc_id = $self->find_unique_doc_id('Q' . $mid); + if (defined $doc_id) { + $db->delete_document($doc_id); + } else { + warn "cannot remove non-existent <$mid>\n"; + } }; if ($@) { -- EW