unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] lei up: faster non-thread, single-source incremental query
Date: Mon,  2 Oct 2023 14:58:07 +0000	[thread overview]
Message-ID: <20231002145807.2665296-1-e@80x24.org> (raw)

When using isearch (that is v1/v2 inbox relying on extindex
for search), there's actually no guarantee that IMAP UIDs
are in the correct order with regard to Xapian docids.

Thus we must iterate through every UID(num) to see if it's
suitable to display in a saved search.  The old grep filter
(before commit a6fe84489127) was not effective since it
didn't account for the mset->items correspondence.

Fortunately, this bug merely manifests in reduced performance
as of a6fe84489127.  Prior to that, it could cause incorrect
keywords and labels to be applied.

Unfortunately, this behavior is hard-to-test so no test case
is included.

Followup-to: a6fe84489127 (lei up: fix missing -t/--threads matches w/ saved search)
---
 lib/PublicInbox/LeiXSearch.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 5f105567..4e0849e8 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -211,9 +211,10 @@ sub query_one_mset { # for --threads and l2m w/o sort
 			}
 		} else {
 			$first_ids = $ids;
-			my @items = $mset->items;
+			my @items = $mset->items; # parallel with @$ids
 			for my $n (@$ids) {
 				my $mitem = $items[$i++];
+				next if $n <= $min;
 				my $smsg = $over->get_art($n) or next;
 				next if $smsg->{bytes} == 0;
 				mitem_kw($srch, $smsg, $mitem, $fl) if $can_kw;

                 reply	other threads:[~2023-10-02 14:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231002145807.2665296-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).