]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Over.pm
www: improve visibility of coderepos
[public-inbox.git] / lib / PublicInbox / Over.pm
index f34e7fc1cb23e10630ea3ab9334a1b4b47e61824..06ea439d484f78bbd51350b6ce490f9b0ec43967 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # for XOVER, OVER in NNTP, and feeds/homepage/threads in PSGI
@@ -261,13 +261,14 @@ SELECT num,tid,ds,ts,ddd FROM over WHERE num = ? LIMIT 1
 }
 
 sub get_xref3 {
-       my ($self, $num) = @_;
+       my ($self, $num, $raw) = @_;
        my $dbh = dbh($self);
        my $sth = $dbh->prepare_cached(<<'', undef, 1);
-SELECT ibx_id,xnum,oidbin FROM xref3 WHERE docid = ? ORDER BY ibx_id ASC
+SELECT ibx_id,xnum,oidbin FROM xref3 WHERE docid = ? ORDER BY ibx_id,xnum ASC
 
        $sth->execute($num);
        my $rows = $sth->fetchall_arrayref;
+       return $rows if $raw;
        my $eidx_key_sth = $dbh->prepare_cached(<<'', undef, 1);
 SELECT eidx_key FROM inboxes WHERE ibx_id = ?
 
@@ -275,6 +276,7 @@ SELECT eidx_key FROM inboxes WHERE ibx_id = ?
                my $r = $_;
                $eidx_key_sth->execute($r->[0]);
                my $eidx_key = $eidx_key_sth->fetchrow_array;
+               $eidx_key //= "missing://ibx_id=$r->[0]";
                "$eidx_key:$r->[1]:".unpack('H*', $r->[2]);
        } @$rows ];
 }