diff options
Diffstat (limited to 'lib/PublicInbox/MiscIdx.pm')
-rw-r--r-- | lib/PublicInbox/MiscIdx.pm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/PublicInbox/MiscIdx.pm b/lib/PublicInbox/MiscIdx.pm index f5a374b2..6708527d 100644 --- a/lib/PublicInbox/MiscIdx.pm +++ b/lib/PublicInbox/MiscIdx.pm @@ -1,11 +1,11 @@ -# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org> +# Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> # like PublicInbox::SearchIdx, but for searching for non-mail messages. # Things indexed include: # * inboxes themselves # * epoch information -# * (maybe) git code repository information +# * (maybe) git code repository information (not commits) # Expect ~100K-1M documents with no parallelism opportunities, # so no sharding, here. # @@ -16,11 +16,11 @@ use v5.10.1; use PublicInbox::InboxWritable; use PublicInbox::Search; # for SWIG Xapian and Search::Xapian compat use PublicInbox::SearchIdx qw(index_text term_generator add_val); -use PublicInbox::Spawn qw(nodatacow_dir); use Carp qw(croak); use File::Path (); use PublicInbox::MiscSearch; use PublicInbox::Config; +use PublicInbox::Syscall; my $json; sub new { @@ -28,9 +28,10 @@ sub new { PublicInbox::SearchIdx::load_xapian_writable(); my $mi_dir = "$eidx->{xpfx}/misc"; File::Path::mkpath($mi_dir); - nodatacow_dir($mi_dir); + PublicInbox::Syscall::nodatacow_dir($mi_dir); my $flags = $PublicInbox::SearchIdx::DB_CREATE_OR_OPEN; $flags |= $PublicInbox::SearchIdx::DB_NO_SYNC if $eidx->{-no_fsync}; + $flags |= $PublicInbox::SearchIdx::DB_DANGEROUS if $eidx->{-dangerous}; $json //= PublicInbox::Config::json(); bless { mi_dir => $mi_dir, @@ -71,7 +72,7 @@ sub remove_eidx_key { } for my $docid (@docids) { $xdb->delete_document($docid); - warn "I: remove inbox docid #$docid ($eidx_key)\n"; + warn "# remove inbox docid #$docid ($eidx_key)\n"; } } @@ -107,12 +108,16 @@ EOF $doc->add_boolean_term('Q'.$eidx_key); # uniQue id $doc->add_boolean_term('T'.'inbox'); # Type + # force reread from disk, {description} could be loaded from {misc} + delete @$ibx{qw(-art_min -art_max description)}; if (defined($ibx->{newsgroup}) && $ibx->nntp_usable) { $doc->add_boolean_term('T'.'newsgroup'); # additional Type + my $n = $ibx->art_min; + add_val($doc, $PublicInbox::MiscSearch::ART_MIN, $n) if $n; + $n = $ibx->art_max; + add_val($doc, $PublicInbox::MiscSearch::ART_MAX, $n) if $n; } - # force reread from disk, {description} could be loaded from {misc} - delete $ibx->{description}; my $desc = $ibx->description; # description = S/Subject (or title) |