-# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# based on notmuch, but with no concept of folders, files or flags
#
package PublicInbox::Search;
use strict;
use parent qw(Exporter);
-our @EXPORT_OK = qw(retry_reopen int_val);
+our @EXPORT_OK = qw(retry_reopen int_val get_pct);
use List::Util qw(max);
# values for searching, changing the numeric value breaks
my $xpfx = $self->{xpfx};
my (@xdb, $slow_phrase);
load_xapian();
+ $self->{qp_flags} //= $QP_FLAGS;
if ($xpfx =~ m/xapian${\SCHEMA_VERSION}\z/) {
@xdb = ($X{Database}->new($xpfx));
$self->{qp_flags} |= FLAG_PHRASE() if !-f "$xpfx/iamchert";
sub xdb ($) {
my ($self) = @_;
$self->{xdb} //= do {
- $self->{qp_flags} //= $QP_FLAGS;
my @xdb = $self->xdb_shards_flat or return;
$self->{nshard} = scalar(@xdb);
my $xdb = shift @xdb;
sortable_unserialise($val) + 0; # PV => IV conversion
}
+sub get_pct ($) { # mset item
+ # Capped at "99%" since "100%" takes an extra column in the
+ # thread skeleton view. <xapian/mset.h> says the value isn't
+ # very meaningful, anyways.
+ my $n = $_[0]->get_percent;
+ $n > 99 ? 99 : $n;
+}
+
1;