about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-10 12:14:58 +0000
committerEric Wong <e@80x24.org>2021-01-12 03:51:42 +0000
commit4ff570e5c3cfb33aff3ca6ad674958d9dd2abda9 (patch)
tree66299a7b22bc523d230ca93f51b0eae3abca4c59 /lib/PublicInbox/Search.pm
parent392533147f50061d93cb9ed82abf98067dde5472 (diff)
downloadpublic-inbox-4ff570e5c3cfb33aff3ca6ad674958d9dd2abda9.tar.gz
Parallelism and interactivity with pager + SIGPIPE needs work;
but results are shown and phrase search works without shell
users having to apply Xapian quoting rules on top of standard
shell quoting.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 0bdf6fc6..7f68ee01 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -6,7 +6,7 @@
 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
@@ -424,4 +424,12 @@ sub int_val ($$) {
         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;