]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/ExtSearch.pm
extsearch: wire up smsg_eml
[public-inbox.git] / lib / PublicInbox / ExtSearch.pm
1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # Read-only external (detached) index for cross inbox search.
5 # This is a read-only counterpart to PublicInbox::ExtSearchIdx
6 package PublicInbox::ExtSearch;
7 use strict;
8 use v5.10.1;
9 use PublicInbox::Over;
10 use PublicInbox::Inbox;
11
12 # for ->reopen, ->mset, ->mset_to_artnums
13 use parent qw(PublicInbox::Search);
14
15 sub new {
16         my (undef, $topdir) = @_;
17         bless {
18                 topdir => $topdir,
19                 # xpfx => 'ei15'
20                 xpfx => "$topdir/ei".PublicInbox::Search::SCHEMA_VERSION
21         }, __PACKAGE__;
22 }
23
24 # overrides PublicInbox::Search::_xdb
25 sub _xdb {
26         my ($self) = @_;
27         $self->xdb_sharded;
28 }
29
30 # same as per-inbox ->over, for now...
31 sub over {
32         my ($self) = @_;
33         $self->{over} //= PublicInbox::Over->new("$self->{xpfx}/over.sqlite3");
34 }
35
36 sub git {
37         my ($self) = @_;
38         $self->{git} //= PublicInbox::Git->new("$self->{topdir}/ALL.git");
39 }
40
41 no warnings 'once';
42 *smsg_eml = \&PublicInbox::Inbox::smsg_eml;
43
44 1;