]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiStore.pm
searchidxshard: IPC conversion, part 2
[public-inbox.git] / lib / PublicInbox / LeiStore.pm
index a23efed55198e96c4ac5446c7681af235b58781c..d686e95a35699fb72b810cf95b3dd9aeb6711efd 100644 (file)
@@ -24,10 +24,7 @@ sub new {
        my (undef, $dir, $opt) = @_;
        my $eidx = PublicInbox::ExtSearchIdx->new($dir, $opt);
        my $self = bless { priv_eidx => $eidx }, __PACKAGE__;
-       if ($opt->{creat}) {
-               PublicInbox::SearchIdx::load_xapian_writable();
-               eidx_init($self);
-       }
+       eidx_init($self) if $opt->{creat};
        $self;
 }
 
@@ -149,7 +146,7 @@ sub set_eml_keywords {
        my $eidx = eidx_init($self);
        my @docids = _docids_for($self, $eml);
        for my $docid (@docids) {
-               $eidx->idx_shard($docid)->shard_set_keywords($docid, @kw);
+               $eidx->idx_shard($docid)->ipc_do('set_keywords', $docid, @kw);
        }
        \@docids;
 }
@@ -159,7 +156,7 @@ sub add_eml_keywords {
        my $eidx = eidx_init($self);
        my @docids = _docids_for($self, $eml);
        for my $docid (@docids) {
-               $eidx->idx_shard($docid)->shard_add_keywords($docid, @kw);
+               $eidx->idx_shard($docid)->ipc_do('add_keywords', $docid, @kw);
        }
        \@docids;
 }
@@ -169,7 +166,7 @@ sub remove_eml_keywords {
        my $eidx = eidx_init($self);
        my @docids = _docids_for($self, $eml);
        for my $docid (@docids) {
-               $eidx->idx_shard($docid)->shard_remove_keywords($docid, @kw);
+               $eidx->idx_shard($docid)->ipc_do('remove_keywords', $docid, @kw)
        }
        \@docids;
 }
@@ -208,8 +205,9 @@ sub add_eml {
                for my $docid (@docids) {
                        my $idx = $eidx->idx_shard($docid);
                        $oidx->add_xref3($docid, -1, $smsg->{blob}, '.');
-                       $idx->shard_add_eidx_info($docid, '.', $eml); # List-Id
-                       $idx->shard_add_keywords($docid, @kw) if @kw;
+                       # add_eidx_info for List-Id
+                       $idx->ipc_do('add_eidx_info', $docid, '.', $eml);
+                       $idx->ipc_do('add_keywords', $docid, @kw) if @kw;
                }
                \@docids;
        } else {
@@ -218,7 +216,7 @@ sub add_eml {
                $oidx->add_xref3($smsg->{num}, -1, $smsg->{blob}, '.');
                my $idx = $eidx->idx_shard($smsg->{num});
                $idx->index_raw($msgref, $eml, $smsg);
-               $idx->shard_add_keywords($smsg->{num}, @kw) if @kw;
+               $idx->ipc_do('add_keywords', $smsg->{num}, @kw) if @kw;
                $smsg;
        }
 }