]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
No ext_urls
[public-inbox.git] / lib / PublicInbox / Search.pm
index 6f9fdde1bc2276cbc0620c794731f179a00750b1..273cc57cf94ba8b12d18acfcefd4aaa13e8a2c7a 100644 (file)
@@ -179,6 +179,7 @@ EOF
        'dfpre:' => 'match pre-image git blob ID',
        'dfpost:' => 'match post-image git blob ID',
        'dfblob:' => 'match either pre or post-image git blob ID',
+       'patchid:' => "match `git patch-id --stable' output",
        'rt:' => <<EOF,
 match received time, like `d:' if sender's clock was correct
 EOF
@@ -459,8 +460,9 @@ sub _enquire_once { # retry_reopen callback
                $enquire->set_sort_by_relevance_then_value(TS, !$opts->{asc});
        }
 
-       # `mairix -t / --threads' or JMAP collapseThreads
-       if ($opts->{threads} && has_threadid($self)) {
+       # `lei q -t / --threads' or JMAP collapseThreads; but don't collapse
+       # on `-tt' ({threads} > 1) which sets the Flagged|Important keyword
+       if (($opts->{threads} // 0) == 1 && has_threadid($self)) {
                $enquire->set_collapse_key(THREADID);
        }
        $enquire->get_mset($opts->{offset} || 0, $opts->{limit} || 50);
@@ -542,9 +544,10 @@ sub help {
        \@ret;
 }
 
+# always returns a scalar value
 sub int_val ($$) {
        my ($doc, $col) = @_;
-       my $val = $doc->get_value($col) or return; # undefined is '' in Xapian
+       my $val = $doc->get_value($col) or return undef; # undef is '' in Xapian
        sortable_unserialise($val) + 0; # PV => IV conversion
 }