about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-02-14 02:42:32 +0000
committerEric Wong <e@80x24.org>2023-02-15 04:31:22 +0000
commit771dda802ec8c13dc13a1daabcefee9f3df9bb38 (patch)
treeda864819b19b00ac8540d0a94d8c64e07cf4abb3
parentdd029354eb69c4faf3160640828fd8e7b9403855 (diff)
downloadpublic-inbox-771dda802ec8c13dc13a1daabcefee9f3df9bb38.tar.gz
While having Xapian collapse threads is an easy way to reduce
the amount of deduplication work we need to do when writing
out threads; we can't rely on it when using `lei q -tt` since
that needs to flag all hits.

Reported-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Link: https://public-inbox.org/git/Y+pgBmj0jxR+cVkD@mail.gmail.com/
-rw-r--r--lib/PublicInbox/Search.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 2feb3e13..273cc57c 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -460,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);