]> Sergey Matveev's repositories - public-inbox.git/commitdiff
Merge remote-tracking branch 'origin/master' into lorelei
authorEric Wong <e@80x24.org>
Thu, 31 Dec 2020 13:24:36 +0000 (13:24 +0000)
committerEric Wong <e@80x24.org>
Thu, 31 Dec 2020 13:24:36 +0000 (13:24 +0000)
* origin/master: (58 commits)
  ds: flatten + reuse @events, epoll_wait style fixes
  ds: simplify EventLoop implementation
  check defined return value for localized slurp errors
  import: check for git->qx errors, clearer return values
  git: qx: avoid extra "local" for scalar context case
  search: remove {mset} option for ->mset method
  search: remove pointless {relevance} setting
  miscsearch: take reopen from Search and use it
  extsearch: unconditionally reopen on access
  extindex: allow using --all without EXTINDEX_DIR
  extindex: add undocumented --no-scan switch
  extindex: enable autoflush on STDOUT/STDERR
  extindex: various --watch signal handling fixes
  extindex: --watch for inotify-based updates
  eml: fix undefined vars on <Perl 5.28
  t/config: test --get-urlmatch for git <2.26
  default to CORE::warn in $SIG{__WARN__} handlers
  inbox: name variable for values loop iterator
  inboxidle: avoid needless syscalls on refresh
  inboxidle: clue users into resolving ENOSPC from inotify
  ...

1  2 
MANIFEST
lib/PublicInbox/Daemon.pm
lib/PublicInbox/ExtSearch.pm
lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/Import.pm
lib/PublicInbox/ManifestJsGz.pm
lib/PublicInbox/OverIdx.pm
lib/PublicInbox/Search.pm
lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/V2Writable.pm

diff --cc MANIFEST
Simple merge
Simple merge
index 7ce950bc11a6cfa59f9b46ecec774c6fa425872d,7c9586a6b65b66cd0443228c21ea17318423053e..2bcdece61e3a4e95090fcbb1aca81f69dedbd975
@@@ -17,8 -16,7 +16,7 @@@ use DBI qw(:sql_types); # SQL_BLO
  use parent qw(PublicInbox::Search);
  
  sub new {
 -      my (undef, $topdir) = @_;
 +      my ($class, $topdir) = @_;
-       $topdir = File::Spec->canonpath($topdir);
        bless {
                topdir => $topdir,
                # xpfx => 'ei15'
@@@ -31,8 -29,12 +29,6 @@@ sub misc 
        $self->{misc} //= PublicInbox::MiscSearch->new("$self->{xpfx}/misc");
  }
  
- sub search { $_[0] } # self
 -# overrides PublicInbox::Search::_xdb
 -sub _xdb {
 -      my ($self) = @_;
 -      $self->xdb_sharded;
 -}
--
  # same as per-inbox ->over, for now...
  sub over {
        my ($self) = @_;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 7e2843e938989d067a2c8f089f5fad6f6314c968,b3361e05c779ffb61f5d0b7ea3a8d15b24e55874..95f4234c4b2b26cc2ca85ccd784a7d56b577db88
@@@ -498,52 -499,6 +496,47 @@@ sub remove_eidx_info 
        $self->{xdb}->replace_document($docid, $doc);
  }
  
- sub get_val ($$) {
-       my ($doc, $col) = @_;
-       sortable_unserialise($doc->get_value($col));
- }
 +sub set_keywords {
 +      my ($self, $docid, @kw) = @_;
 +      begin_txn_lazy($self);
 +      my $doc = _get_doc($self, $docid) or return;
 +      my %keep = map { $_ => 1 } @kw;
 +      my %add = %keep;
 +      my @rm;
 +      my $end = $doc->termlist_end;
 +      for (my $cur = $doc->termlist_begin; $cur != $end; $cur++) {
 +              $cur->skip_to('K');
 +              last if $cur == $end;
 +              my $kw = $cur->get_termname;
 +              $kw =~ s/\AK//s or next;
 +              $keep{$kw} ? delete($add{$kw}) : push(@rm, $kw);
 +      }
 +      return unless (scalar(@rm) + scalar(keys %add));
 +      $doc->remove_term('K'.$_) for @rm;
 +      $doc->add_boolean_term('K'.$_) for (keys %add);
 +      $self->{xdb}->replace_document($docid, $doc);
 +}
 +
 +sub add_keywords {
 +      my ($self, $docid, @kw) = @_;
 +      begin_txn_lazy($self);
 +      my $doc = _get_doc($self, $docid) or return;
 +      $doc->add_boolean_term('K'.$_) for @kw;
 +      $self->{xdb}->replace_document($docid, $doc);
 +}
 +
 +sub remove_keywords {
 +      my ($self, $docid, @kw) = @_;
 +      begin_txn_lazy($self);
 +      my $doc = _get_doc($self, $docid) or return;
 +      my $replace;
 +      eval {
 +              $doc->remove_term('K'.$_);
 +              $replace = 1
 +      } for @kw;
 +      $self->{xdb}->replace_document($docid, $doc) if $replace;
 +}
 +
  sub smsg_from_doc ($) {
        my ($doc) = @_;
        my $data = $doc->get_data or return;
Simple merge