diff options
author | Eric Wong <e@80x24.org> | 2015-08-13 02:32:22 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-13 03:30:40 +0000 |
commit | 675494c58ef7a39a92c79cbf02975b9da3991c0b (patch) | |
tree | 5ab166b191b8bec3e112977b86ae7806ef1952d6 /public-inbox-index | |
parent | 2981d6929f400630e575bcc8fc1851bc531e73e9 (diff) | |
download | public-inbox-675494c58ef7a39a92c79cbf02975b9da3991c0b.tar.gz |
This shall allow us to search for replies/threads more easily.
Diffstat (limited to 'public-inbox-index')
-rw-r--r-- | public-inbox-index | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/public-inbox-index b/public-inbox-index new file mode 100644 index 00000000..9cfcadc2 --- /dev/null +++ b/public-inbox-index @@ -0,0 +1,29 @@ +#!/usr/bin/perl -w +# Copyright (C) 2015, all contributors (git clone git://80x24.org/public-inbox) +# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) +# Basic tool to create a Xapian search index for a git repository +# configured for public-inbox. +# Usage with libeatmydata <https://www.flamingspork.com/projects/libeatmydata/> +# highly recommended: eatmydata public-inbox-index GIT_DIR + +use strict; +use warnings; +my $usage = "public-inbox-index GIT_DIR"; +use PublicInbox::Config; +use PublicInbox::Search; +use PublicInbox::GitCatFile; + +sub usage { print STDERR "Usage: $usage\n"; exit 1 } +if (@ARGV) { + foreach my $dir (@ARGV) { + index_dir($dir); + } +}; + +sub index_dir { + my ($git_dir) = @_; + -d $git_dir or die "$git_dir does not appear to be a git repository\n"; + my $git = PublicInbox::GitCatFile->new($git_dir); + my $s = PublicInbox::Search->new($git_dir, 1); + $s->index_sync($git); +} |