about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-19 05:18:01 +0000
committerEric Wong <e@80x24.org>2019-12-20 03:09:28 +0000
commitf6f0cfb7f3b673f05a95e8c9c3bc7d31580feadc (patch)
tree26f32f4ed58e17c9041deabb804cd754ea2a0290 /lib/PublicInbox/View.pm
parent3082849c654fdee12ad97396b4e39be3c4888c1d (diff)
downloadpublic-inbox-f6f0cfb7f3b673f05a95e8c9c3bc7d31580feadc.tar.gz
The displays the Xapian ->get_percent value in the skeleton to
improve scanning of relevancy; irrelevant results do not display
that.

This fixes broken #anchor links introduced in the previous
commit, irrelevant messages now link to the /$INBOX/$MESSAGE_ID page.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 33f71990..5924a2a7 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -950,7 +950,18 @@ sub skel_dump {
         my $obfs_ibx = $ctx->{-obfs_ibx};
         obfuscate_addrs($obfs_ibx, $f) if $obfs_ibx;
 
-        my $d = fmt_ts($smsg->{ds}) . ' ' . indent_for($level) . th_pfx($level);
+        my $d = fmt_ts($smsg->{ds});
+        my $unmatched; # if lazy-loaded by SearchThread::Msg::visible()
+        if (my $pct = $ctx->{pct}) {
+                $pct = $pct->{$smsg->{mid}};
+                if (defined $pct) {
+                        $d .= (sprintf(' % 3u', $pct) . '%');
+                } else {
+                        $unmatched = 1;
+                        $d .= '     ';
+                }
+        }
+        $d .= ' ' . indent_for($level) . th_pfx($level);
         my $attr = $f;
         $ctx->{first_level} ||= $level;
 
@@ -976,7 +987,6 @@ sub skel_dump {
         # our Xapian which would've resulted in '' if it were
         # really missing (and Filter rejects empty subjects)
         my @subj = split(/ /, subject_normalized($smsg->subject));
-
         # remove common suffixes from the subject if it matches the previous,
         # so we do not show redundant text at the end.
         my $prev_subj = $ctx->{prev_subj} || [];
@@ -993,7 +1003,7 @@ sub skel_dump {
         }
         my $m;
         my $id = '';
-        my $mapping = $ctx->{mapping};
+        my $mapping = $unmatched ? undef : $ctx->{mapping};
         if ($mapping) {
                 my $map = $mapping->{$mid};
                 $id = id_compress($mid, 1);
@@ -1011,8 +1021,8 @@ sub _skel_ghost {
         my ($ctx, $level, $node) = @_;
 
         my $mid = $node->{id};
-        my $d = $ctx->{pct} ? '    [irrelevant] ' # search result
-                            : '     [not found] ';
+        my $d = '     [not found] ';
+        $d .= '     '  if exists $ctx->{pct};
         $d .= indent_for($level) . th_pfx($level);
         my $upfx = $ctx->{-upfx};
         my $m = PublicInbox::Hval->new_msgid($mid);