about summary refs log tree commit homepage
path: root/lib/PublicInbox/NewsGroup.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-30 21:00:25 +0000
committerEric Wong <e@80x24.org>2015-09-30 21:09:23 +0000
commit1d236e649df10515bf042fa2283eef509648d9c9 (patch)
tree504b59e2c719f948b3f3224935ae212941d79a7c /lib/PublicInbox/NewsGroup.pm
parent3393117e5ff8faef209bbf4988a59743f00b2a80 (diff)
downloadpublic-inbox-1d236e649df10515bf042fa2283eef509648d9c9.tar.gz
The document data of a search message already contains a good chunk
of the information needed to respond to OVER/XOVER commands quickly.
Expand on that and use the document data to implement OVER/XOVER
quickly.

This adds a dependency on Xapian being available for nntpd usage,
but is probably alright since nntpd is esoteric enough that anybody
willing to run nntpd will also want search functionality offered
by Xapian.

This also speeds up XHDR/HDR with the To: and Cc: headers and
:bytes/:lines article metadata used by some clients for header
displays and marking messages as read/unread.
Diffstat (limited to 'lib/PublicInbox/NewsGroup.pm')
-rw-r--r--lib/PublicInbox/NewsGroup.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/PublicInbox/NewsGroup.pm b/lib/PublicInbox/NewsGroup.pm
index 1250b0d8..02e90111 100644
--- a/lib/PublicInbox/NewsGroup.pm
+++ b/lib/PublicInbox/NewsGroup.pm
@@ -6,6 +6,7 @@ use warnings;
 use Scalar::Util qw(weaken);
 require Danga::Socket;
 require PublicInbox::Msgmap;
+require PublicInbox::Search;
 require PublicInbox::GitCatFile;
 
 sub new {
@@ -36,11 +37,16 @@ sub gcf {
         };
 }
 
+sub usable {
+        my ($self) = @_;
+        eval {
+                PublicInbox::Msgmap->new($self->{git_dir});
+                PublicInbox::Search->new($self->{git_dir});
+        };
+}
+
 sub mm {
-        my ($self, $check_only) = @_;
-        if ($check_only) {
-                return eval { PublicInbox::Msgmap->new($self->{git_dir}) };
-        }
+        my ($self) = @_;
         $self->{mm} ||= eval {
                 my $mm = PublicInbox::Msgmap->new($self->{git_dir});
 
@@ -53,7 +59,6 @@ sub mm {
 sub search {
         my ($self) = @_;
         $self->{search} ||= eval {
-                require PublicInbox::Search;
                 my $search = PublicInbox::Search->new($self->{git_dir});
 
                 # may be needed if we run low on handles