From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6315 166.70.0.0/16 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 37313208EA; Tue, 17 Jul 2018 23:32:02 +0000 (UTC) Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ffZRp-0003vT-K3; Tue, 17 Jul 2018 17:32:01 -0600 Received: from [97.119.167.31] (helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ffZRo-0003Fa-Rq; Tue, 17 Jul 2018 17:32:01 -0600 From: "Eric W. Biederman" To: Eric Wong Cc: meta@public-inbox.org, "Eric W. Biederman" Date: Tue, 17 Jul 2018 18:30:58 -0500 Message-Id: <20180717233058.30820-3-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <87a7qpjve8.fsf@xmission.com> References: <87a7qpjve8.fsf@xmission.com> X-XM-SPF: eid=1ffZRo-0003Fa-Rq;;;mid=<20180717233058.30820-3-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18kn8oBa86B4OyD7XOqXva2lriyHTxfTM0= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH 3/3] SearchIdx: Allow the amount of indexing be configured X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) List-Id: This adds a new inbox configuration option 'indexlevel' that can take the values 'positions', 'terms', and 'over'. When set to 'positions' everything is indexed including the positions of all terms. When set to 'terms' everything except the positions of terms is indexed. When set to 'over' terms and positions are not indexed. Just the Overview database for NNTP is created. Which is still quite good and allows searching for messages by Message-ID. But there are no indexes to support searching inside the email messages themselves. Signed-off-by: "Eric W. Biederman" --- lib/PublicInbox/Config.pm | 2 +- lib/PublicInbox/SearchIdx.pm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 289c36a6ccf1..78586560cf0f 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -158,7 +158,7 @@ sub _fill { foreach my $k (qw(mainrepo filter url newsgroup infourl watch watchheader httpbackendmax - replyto feedmax nntpserver)) { + replyto feedmax nntpserver indexlevel)) { my $v = $self->{"$pfx.$k"}; $rv->{$k} = $v if defined $v; } diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index deb87db3f88a..c42821f813a7 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -47,6 +47,7 @@ sub git_unquote ($) { sub new { my ($class, $ibx, $creat, $part) = @_; + my $levels = qr/(positions|terms|over)/; my $mainrepo = $ibx; # for "public-inbox-index" w/o entry in config my $git_dir = $mainrepo; my ($altid, $git); @@ -62,6 +63,13 @@ sub new { PublicInbox::AltId->new($ibx, $_); } @$altid ]; } + if ($ibx->{indexlevel}) { + if ($ibx->{indexlevel} =~ $levels) { + $indexlevel = $ibx->{indexlevel}; + } else { + die("Invalid indexlevel $ibx->{indexlevel}\n"); + } + } } else { # v1 $ibx = { mainrepo => $git_dir, version => 1 }; } -- 2.17.1