about summary refs log tree commit homepage
path: root/lib/PublicInbox/ExtSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-10-27 07:54:49 +0000
committerEric Wong <e@80x24.org>2020-11-07 10:22:09 +0000
commitd2eb1ae16e4d3aaa5bece96f17b2fa4561d5b18e (patch)
tree1fe34db78d6ded9412c3ea1c9d0792cadb198930 /lib/PublicInbox/ExtSearch.pm
parent9ebb1544ac677d3ed37231cfd78624916b6f2945 (diff)
downloadpublic-inbox-d2eb1ae16e4d3aaa5bece96f17b2fa4561d5b18e.tar.gz
This lets us pretend an ExtSearch object is an Inbox object
in most of the existing WWW code.
Diffstat (limited to 'lib/PublicInbox/ExtSearch.pm')
-rw-r--r--lib/PublicInbox/ExtSearch.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/PublicInbox/ExtSearch.pm b/lib/PublicInbox/ExtSearch.pm
index 3e8ca82c..66c99eaa 100644
--- a/lib/PublicInbox/ExtSearch.pm
+++ b/lib/PublicInbox/ExtSearch.pm
@@ -3,6 +3,7 @@
 
 # Read-only external (detached) index for cross inbox search.
 # This is a read-only counterpart to PublicInbox::ExtSearchIdx
+# and behaves like PublicInbox::Inbox AND PublicInbox::Search
 package PublicInbox::ExtSearch;
 use strict;
 use v5.10.1;
@@ -21,6 +22,8 @@ sub new {
         }, __PACKAGE__;
 }
 
+sub search { $_[0] } # self
+
 # overrides PublicInbox::Search::_xdb
 sub _xdb {
         my ($self) = @_;
@@ -38,7 +41,29 @@ sub git {
         $self->{git} //= PublicInbox::Git->new("$self->{topdir}/ALL.git");
 }
 
+sub mm { undef }
+
+sub altid_map { {} }
+
+sub description {
+        my ($self) = @_;
+        ($self->{description} //=
+                PublicInbox::Inbox::cat_desc("$self->{topdir}/description")) //
+                '$EINDEX_DIR/description missing';
+}
+
+sub cloneurl { [] } # TODO
+
+sub base_url { 'https://example.com/TODO/' }
+sub nntp_url { [] }
+
 no warnings 'once';
 *smsg_eml = \&PublicInbox::Inbox::smsg_eml;
+*smsg_by_mid = \&PublicInbox::Inbox::smsg_by_mid;
+*msg_by_mid = \&PublicInbox::Inbox::msg_by_mid;
+*modified = \&PublicInbox::Inbox::modified;
+*recent = \&PublicInbox::Inbox::recent;
+
+*max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef
 
 1;