diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-02-20 21:00:21 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-02-20 21:00:21 +0000 |
commit | feabfb1809b911fc97538282234c8b1f087ddb6a (patch) | |
tree | 8fc484f46f1c2c191ccb0a72fcbebfcad38bc115 /lib/PublicInbox/Search.pm | |
parent | b42bbc915750cf2f0c559514041ba3f5d1a44a12 (diff) | |
download | public-inbox-feabfb1809b911fc97538282234c8b1f087ddb6a.tar.gz |
This is too slow, currently. Working with only 2017 LKML archives: git-only: ~1 minute git + SQLite: ~12 minutes git+Xapian+SQlite: ~45 minutes So yes, it looks like we'll need to parallelize Xapian indexing, at least.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r-- | lib/PublicInbox/Search.pm | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 33a1f2d3..eac11bd4 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -120,15 +120,29 @@ chomp @HELP; my $mail_query = Search::Xapian::Query->new('T' . 'mail'); sub xdir { - my (undef, $git_dir) = @_; - "$git_dir/public-inbox/xapian" . SCHEMA_VERSION; + my ($self) = @_; + if ($self->{version} == 1) { + "$self->{mainrepo}/public-inbox/xapian" . SCHEMA_VERSION; + } else { + "$self->{mainrepo}/xap" . SCHEMA_VERSION; + } } sub new { - my ($class, $git_dir, $altid) = @_; - my $dir = $class->xdir($git_dir); - my $db = Search::Xapian::Database->new($dir); - bless { xdb => $db, git_dir => $git_dir, altid => $altid }, $class; + my ($class, $mainrepo, $altid) = @_; + my $version = 1; + my $ibx = $mainrepo; + if (ref $ibx) { + $version = $ibx->{version} || 1; + $mainrepo = $ibx->{mainrepo}; + } + my $self = bless { + mainrepo => $mainrepo, + altid => $altid, + version => $version, + }, $class; + $self->{xdb} = Search::Xapian::Database->new($self->xdir); + $self; } sub reopen { $_[0]->{xdb}->reopen } |