From 1d236e649df10515bf042fa2283eef509648d9c9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 30 Sep 2015 21:00:25 +0000 Subject: nntp: implement OVER/XOVER summary in search document 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. --- lib/PublicInbox/NewsGroup.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/PublicInbox/NewsGroup.pm') 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 -- cgit v1.2.3-24-ge0c7