Re: [imapext] SEARCHRES RFC5182

Dave Cridland <dave@cridland.net> Thu, 11 March 2021 11:48 UTC

Return-Path: <dave@cridland.net>
X-Original-To: imapext@ietfa.amsl.com
Delivered-To: imapext@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 617163A1A13 for <imapext@ietfa.amsl.com>; Thu, 11 Mar 2021 03:48:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cridland.net
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3RvrRUdNfoqP for <imapext@ietfa.amsl.com>; Thu, 11 Mar 2021 03:48:56 -0800 (PST)
Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 68E0A3A1A12 for <imapext@ietf.org>; Thu, 11 Mar 2021 03:48:56 -0800 (PST)
Received: by mail-wm1-x32d.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so9659462wmj.2 for <imapext@ietf.org>; Thu, 11 Mar 2021 03:48:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cridland.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=T5hIKFH91ifTD1i3sppRut4Z0Yx2wFcZOVZ44ZlNr4w=; b=e3PGnwxmbGiM8mSBQB/8/XIVxd35Q40iIbvFnA+xkocEyxD7PA0BOkOVmFYAmWRrrl JhEdNixbWOocIyzaPUuDUGwh/u2Mmdb9IiiMXquHL0Rw2QwV36I9MhyaQTtEEBCkcVVF b1FOBmZ0waDFJg6mEKxF/0/3QQy4OZt8U4084=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T5hIKFH91ifTD1i3sppRut4Z0Yx2wFcZOVZ44ZlNr4w=; b=N4yibmS1iPnqFm3BGOiPcPoamV9Dr0zt/PJ8rk3VXD14drsPU9p6x9kHFg7hDUpiyC vWwbwuvfNvWzm1Q/Pfyj3Awi1QIGlXvn2Q+5LCGs725RarFdnCttcV78E+xscfMXnWka YxO4v6PoaqDBWzIW0KnF8E1TSLqIemGMxHhqOAYU4w6tvvXxM8stMgR5FNEEfMEMyKsp aIJUk09cHukVbU6DfVnT5Cf3aQF5GsjdZ/eOcxyuOX/l0DQzb6gIWvEo8gXIpTmTLQgM XxJFkgeyLDOO7j31eq9tzXXdKg1j2VijdD7t8xBYaf2ZAuWSskqhHMFwRuFp6PsMXksh dEog==
X-Gm-Message-State: AOAM531yKetP2eg2c/baPYkrs0dvzZTWZJd290nC5Wrw26iCewa4bd0M aX102V4QH11yW5wVXPzL85o3dOeJnCWAhQti/TdJtyJYwLQ=
X-Google-Smtp-Source: ABdhPJwryTnPVCaXTUtl1T9xuWKh1b2jfRCzL90RDLT7+NR9w5hXhxQz2cSZCymdZMShN/58TqzdyFi4506j7tsyj2k=
X-Received: by 2002:a7b:c3cd:: with SMTP id t13mr7753723wmj.109.1615463334261; Thu, 11 Mar 2021 03:48:54 -0800 (PST)
MIME-Version: 1.0
References: <CAO0d3bLXzYynT-9BxDy2DS4nHGzVM2hBTAQyyy2nhu-s1FmsNg@mail.gmail.com> <CAO0d3bJ_ma7R+0Xti0sO8fEL9g1qJWfs8F25O7GODT2r4eEzaQ@mail.gmail.com> <f53b4661-1d6c-4243-b76d-169ba1a33017@gulbrandsen.priv.no> <40f8d9ec-2387-4e38-819d-fdb4407c5709@spark> <e90008f2-fde5-4596-a1a9-4dc6d8ea9753@gulbrandsen.priv.no> <3089d87b-5884-44bf-8eb9-ef5d34f16756@spark> <em68d5d29d-695c-4b42-be1c-4d99ee6bcf08@bombadil> <23240094-4827-f85e-6ad5-6b22bc09905b@isode.com> <emedd85d67-977f-4847-922b-541a4f97294d@bombadil>
In-Reply-To: <emedd85d67-977f-4847-922b-541a4f97294d@bombadil>
From: Dave Cridland <dave@cridland.net>
Date: Thu, 11 Mar 2021 11:48:43 +0000
Message-ID: <CAKHUCzyxu7qCBAcxTw6S4i-djuRZnc6rHtKd9bzPHY1ygnmTQQ@mail.gmail.com>
To: Adrien de Croy <adrien@qbik.com>
Cc: Alexey Melnikov <alexey.melnikov@isode.com>, "imapext@ietf.org" <imapext@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000002fc5be05bd415ec9"
Archived-At: <https://mailarchive.ietf.org/arch/msg/imapext/cwJauyi50cV7CyDGtBCvrxlnd-o>
Subject: Re: [imapext] SEARCHRES RFC5182
X-BeenThere: imapext@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Discussion of IMAP extensions <imapext.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/imapext>, <mailto:imapext-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/imapext/>
List-Post: <mailto:imapext@ietf.org>
List-Help: <mailto:imapext-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/imapext>, <mailto:imapext-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Mar 2021 11:48:59 -0000

On Wed, 10 Mar 2021 at 20:14, Adrien de Croy <adrien@qbik.com> wrote:

> Hi Alexey
>
> ------ Original Message ------
> From: "Alexey Melnikov" <alexey.melnikov@isode.com>
> To: "Adrien de Croy" <adrien@qbik.com>
> Cc: "imapext@ietf.org" <imapext@ietf.org>
> Sent: 10/03/2021 11:07:25 pm
> Subject: Re: [imapext] SEARCHRES RFC5182
>
> Hi Adrien,
> On 09/03/2021 23:21, Adrien de Croy wrote:
>
> Hi Everyone
>
> I've been looking into this extension, but it has a number of problems and
> uncertainties in the spec especially:
>
> * in relation to storing results of ESEARCH extensions, it refers to them
> as messages).
>
> Can you elaborate/quote specific text which is confusing?
>
>
>
> When the SAVE result option is combined with the MIN or MAX [ESEARCH]
>    result option, and none of the other ESEARCH result options are
>    present, the corresponding MIN/MAX is returned (if the search result
>    is not empty), but the "$" marker would contain a single message as
>    returned in the MIN/MAX return item.
>
>
> It's not clear if $ is storing the result of the MIN, or something else.
> But I guess those are the same for MIN and MAX - the IDs.
>
> $ only stores message IDs, not messages.  Maybe replace "contain a single
> message" with "refers to a single message" or "contains the message ID"
>
>
Well, it depends on how you see it conceptually.

You could have the server store a list of UIDs always, and translate as
required.

You could also have the server store a list of tuples of (UID,seq), and
filter as needed, updating the sequence numbers if an EXPUNGE occurs.

Or you could have the server store $ as a
std::vector<std::shared_ptr<Message>> or something and format as UID or seq
appropriately.

In all three cases (and more) you're conceptually storing references to
messages, though, and whether they're ids or not is somewhat irrelevant -
when executing the search itself, you're working on messages rather than
identifiers.

The one thing that "$" definitely doesn't contain is a list of integers,
though.


> I guess I should have read it a few more times.  Maybe it's not so unclear.
>
>
> * in relation to reporting errors if the saved results are incompatible
> (e.g. stored SEQ but asked to use as UID or vice versa)
>
> The document is quite clear that $ references message numbers or UIDs as
> appropriate in the corresponding context. So a saved result is never
> incompatible.
>
>
> So we save both UIDs and SEQ and adjust these on expunge, and just use
> whichever one is appropriate in the subsequent commands.
>

I suspect I'd store yet another internal identifier, myself, but loosely
store whatever makes you get the right external behaviour. If UIDs work for
you, I'd store only UIDs and treat a "$" as if it were "UID $" as
needed, for example. But remember it's never a simple string substitution -
otherwise "$" would fail if the saved set were to contain no messages.

As for whether people use this in clients, I don't know - it's been fairly
esoteric until now, but IMAP4rev2 might change this. It's very useful for
"Mark all as" from a search output for online clients, but there aren't
many of those around anymore.

Dave.