about summary refs log tree commit homepage
path: root/lib/PublicInbox/MiscSearch.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/MiscSearch.pm')
-rw-r--r--lib/PublicInbox/MiscSearch.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/PublicInbox/MiscSearch.pm b/lib/PublicInbox/MiscSearch.pm
index 8beb8349..5a44d751 100644
--- a/lib/PublicInbox/MiscSearch.pm
+++ b/lib/PublicInbox/MiscSearch.pm
@@ -76,4 +76,23 @@ sub mset {
         retry_reopen($self, \&misc_enquire_once, [ $self, $qr, $opt ]);
 }
 
+sub ibx_data_once {
+        my ($self, $ibx) = @{$_[0]};
+        my $xdb = $self->{xdb};
+        my $eidx_key = $ibx->eidx_key; # may be {inboxdir}, so private
+        my $head = $xdb->postlist_begin('Q'.$eidx_key);
+        my $tail = $xdb->postlist_end('Q'.$eidx_key);
+        if ($head != $tail) {
+                my $doc = $xdb->get_document($head->get_docid);
+                $doc->get_data;
+        } else {
+                undef;
+        }
+}
+
+sub inbox_data {
+        my ($self, $ibx) = @_;
+        retry_reopen($self, \&ibx_data_once, [ $self, $ibx ]);
+}
+
 1;