From feabfb1809b911fc97538282234c8b1f087ddb6a Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Tue, 20 Feb 2018 21:00:21 +0000 Subject: v2: support Xapian + SQLite indexing 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. --- lib/PublicInbox/Search.pm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/Search.pm') 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 } -- cgit v1.2.3-24-ge0c7