about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-31 00:02:06 +0000
committerEric Wong <e@80x24.org>2016-07-31 23:40:56 +0000
commit3f4c9ce3d2c0796c6c3f352b5b586ddd7a85ffb0 (patch)
tree7fa0e627978a1d62024fc70c7b32c57707a2550b /script
parent3a988efc28064954e64419bb0d368684fa7c7f20 (diff)
downloadpublic-inbox-3f4c9ce3d2c0796c6c3f352b5b586ddd7a85ffb0.tar.gz
This should make tweaking the way we search more efficiet
by allowing us to avoid doubling destroying the index every
time we want to change something.

We also give priority to incremental indexing via
public-inbox-{watch,mda} and have manual invocations of
public-inbox-index perform batch updates while releasing
ssoma.lock.
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-index9
1 files changed, 7 insertions, 2 deletions
diff --git a/script/public-inbox-index b/script/public-inbox-index
index 46584c1f..61f21d70 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -8,6 +8,7 @@
 
 use strict;
 use warnings;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 my $usage = "public-inbox-index GIT_DIR";
 use PublicInbox::Config;
 eval { require PublicInbox::SearchIdx };
@@ -15,6 +16,11 @@ if ($@) {
         print STDERR "Search::Xapian required for $0\n";
         exit 1;
 }
+
+my $reindex;
+my %opts = ( '--reindex' => \$reindex );
+GetOptions(%opts) or die "bad command-line args\n$usage";
+
 my @dirs;
 
 sub resolve_git_dir {
@@ -57,7 +63,6 @@ foreach my $dir (@dirs) {
 sub index_dir {
         my ($git_dir) = @_;
         -d $git_dir or die "$git_dir does not appear to be a git repository\n";
-
         my $s = PublicInbox::SearchIdx->new($git_dir, 1);
-        $s->index_sync;
+        $s->index_sync({ reindex => $reindex });
 }