about summary refs log tree commit
path: root/lib/PublicInbox/Inbox.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r--lib/PublicInbox/Inbox.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 4f27d1bb..95ffd039 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -376,4 +376,19 @@ sub modified {
         git($self)->modified; # v1
 }
 
+# returns prefix => pathname mapping
+# (pathname is NOT public, but prefix is used for Xapian queries)
+sub altid_map ($) {
+        my ($self) = @_;
+        $self->{-altid_map} //= eval {
+                require PublicInbox::AltId;
+                my $altid = $self->{altid} or return {};
+                my %h = map {;
+                        my $x = PublicInbox::AltId->new($self, $_);
+                        "$x->{prefix}" => $x->{filename}
+                } @$altid;
+                \%h;
+        } // {};
+}
+
 1;