]> Sergey Matveev's repositories - public-inbox.git/commitdiff
isearch: use numeric sort for article numbers
authorEric Wong <e@80x24.org>
Mon, 21 Dec 2020 07:51:19 +0000 (07:51 +0000)
committerEric Wong <e@80x24.org>
Mon, 21 Dec 2020 21:51:56 +0000 (21:51 +0000)
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

index 8a1f257ae1062b67bbb4dadd9eacfc91024d8d2f..e362c80aec14ca3c60572c716f2954089406ca8e 100644 (file)
@@ -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";
        }