From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E18891FA12 for ; Mon, 21 Dec 2020 07:51:22 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/5] isearch: use numeric sort for article numbers Date: Mon, 21 Dec 2020 07:51:19 +0000 Message-Id: <20201221075122.1587-3-e@80x24.org> In-Reply-To: <20201221075122.1587-1-e@80x24.org> References: <20201221075122.1587-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Perl sort is alphabetical by default and Xapian uses numeric document IDs, so sort must be told explicitly to use numeric comparisons even if the scalars are integer values (IV) internally. And eliminate extra hash marks ("#") since they're probably too noisy if there are many IDs. Note: I haven't seen this warning message in syslog, yet :> --- lib/PublicInbox/Isearch.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Isearch.pm b/lib/PublicInbox/Isearch.pm index 8a1f257a..e362c80a 100644 --- a/lib/PublicInbox/Isearch.pm +++ b/lib/PublicInbox/Isearch.pm @@ -89,7 +89,7 @@ SELECT docid,xnum FROM xref3 WHERE ibx_id = ? AND docid IN ($qmarks) } if (scalar keys %order) { warn "W: $self->{es}->{topdir} #", - join(', #', sort keys %order), + join(', ', sort { $a <=> $b } keys %order), " not mapped to `$self->{eidx_key}'\n"; warn "W: $self->{es}->{topdir} may need to be reindexed\n"; @xnums = grep { defined } @xnums; @@ -113,7 +113,7 @@ sub mset_to_smsg { } if (scalar keys %order) { warn "W: $ibx->{inboxdir} #", - join(', #', sort keys %order), + join(', ', sort { $a <=> $b } keys %order), " no longer valid\n"; warn "W: $self->{es}->{topdir} may need to be reindexed\n"; }