about summary refs log tree commit homepage
path: root/lib/PublicInbox/Over.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-10-27 07:54:43 +0000
committerEric Wong <e@80x24.org>2020-11-07 10:22:02 +0000
commit090238c3353438526dec707dad0718cb21efd07f (patch)
tree4fa03482912adf469784eaf67917ebfa8935d952 /lib/PublicInbox/Over.pm
parent6646958f416f55745521b1112a38c9f3e3854cdc (diff)
downloadpublic-inbox-090238c3353438526dec707dad0718cb21efd07f.tar.gz
We may not end up storing xref3 data in Xapian, actually.
This will make indexlevel=basic possible, and along with
--sequential-shard indexing support for slow storage.

Making oidmap a separate table seems unnecessary, too, so
fold it into the xref3 table since it's unlikely a git blob
will be responsible for multiple xref3 rows.
Diffstat (limited to 'lib/PublicInbox/Over.pm')
-rw-r--r--lib/PublicInbox/Over.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm
index 08112386..f34e7fc1 100644
--- a/lib/PublicInbox/Over.pm
+++ b/lib/PublicInbox/Over.pm
@@ -260,6 +260,25 @@ SELECT num,tid,ds,ts,ddd FROM over WHERE num = ? LIMIT 1
         $smsg ? load_from_row($smsg) : undef;
 }
 
+sub get_xref3 {
+        my ($self, $num) = @_;
+        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
+
+        $sth->execute($num);
+        my $rows = $sth->fetchall_arrayref;
+        my $eidx_key_sth = $dbh->prepare_cached(<<'', undef, 1);
+SELECT eidx_key FROM inboxes WHERE ibx_id = ?
+
+        [ map {
+                my $r = $_;
+                $eidx_key_sth->execute($r->[0]);
+                my $eidx_key = $eidx_key_sth->fetchrow_array;
+                "$eidx_key:$r->[1]:".unpack('H*', $r->[2]);
+        } @$rows ];
+}
+
 sub next_by_mid {
         my ($self, $mid, $id, $prev) = @_;
         my $dbh = dbh($self);