From cd196679300c54f840e7569dba97005c449f99ab Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Wed, 18 Jul 2018 11:53:25 -0500 Subject: SearchIdx: Allow the amount of indexing be configured This adds a new inbox configuration option 'indexlevel' that can take the values 'full', 'medium', and 'basic'. When set to 'full' everything is indexed including the positions of all terms. When set to 'medium' everything except the positions of terms is indexed. When set to 'basic' 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. Update the reindex tests to exercise the full medium and basic code paths Signed-off-by: "Eric W. Biederman" --- lib/PublicInbox/SearchIdx.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/PublicInbox/SearchIdx.pm') diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 8978914a..04e85306 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/\A(?:full|medium|basic)\z/; 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 }; } -- cgit v1.2.3-24-ge0c7