From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2CBD81F626; Tue, 14 Feb 2023 02:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1676342552; bh=n0aFxAOuGJ/rclDWEDUIei8U/ObszjB+5xUJeZ13xko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ixlpnYGvxzDOW6n+EIlGO3iJumsbBqh5F271c9QXsgIsiDEqXEVomHr3JeHEzF5Gn 13AKXsUYR/mOwKdtdU6h1XRieZJwIgUBYQJmYqeRW000m9vysw6oODc7CF+zj22Egc 4Krfl/eE1GS3Bpsfc86JxlfgsaR+ckEnQKfYC8+c= Date: Tue, 14 Feb 2023 02:42:32 +0000 From: Eric Wong To: Maxim Mikityanskiy Cc: meta@public-inbox.org, Kyle Meyer Subject: [PATCH] lei q: do not collapse threads with `-tt' Message-ID: <20230214024232.M64373@dcvr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Maxim Mikityanskiy wrote: > lei q --no-save -a -o /tmp/lei-test -I 'https://lore.kernel.org/all' \ > -tt 'a:syzbot AND rt:2023-01-01..2023-01-07' At first, I thought -a (--augment) was causing it... Sidenote: you also don't need to quote the query (I forget the exact rules, but I tried to keep quotes easier for phrase searches). > It looks as if the match works correctly, but the -tt option fails to > mark most of the matched emails as important, except a few that actually > got marked (I couldn't find a pattern here). It's also not consistent, > for example, after I removed /tmp/lei-test and restarted the lei q > command, I got many more important emails, almost in each thread, but > there were still threads without flagged emails. Yes, now it seems it's the collapsing optimization. > I'm checking the flags with mutt. > > Does anyone know what could be the reason for such behavior? I think the following patch fixes it. (I accidentally sent you a private copy with invalid blobs since I had other unpublished changes) -----8<------- Subject: [PATCH] lei q: do not collapse threads with `-tt' 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 Link: https://public-inbox.org/git/Y+pgBmj0jxR+cVkD@mail.gmail.com/ --- lib/PublicInbox/Search.pm | 5 +++-- 1 file 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);