unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: David Bremner <david@tethera.net>,
	David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH] WIP: add all subjects to value.
Date: Fri, 04 May 2018 09:48:52 -0400	[thread overview]
Message-ID: <87k1sjo7jv.fsf@fifthhorseman.net> (raw)
In-Reply-To: <20171219141540.21421-2-david@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]

I like the ideas behind this patch.  it's labeled WIP, presumably
because it doesn't handle ordering the subject lines, right?

further comments below inline:

On Tue 2017-12-19 09:15:40 -0400, David Bremner wrote:
> +/* Remove all values from a document; currently these are
> +   all regenerated during indexing */
> +
> +notmuch_private_status_t
> +_notmuch_message_remove_values (notmuch_message_t *message)
> +{
> +    try {
> +	message->doc.clear_values ();
> +	message->modified = TRUE;
> +    } catch (const Xapian::Error &error) {
> +	notmuch_database_t *notmuch = message->notmuch;
> +
> +	if (!notmuch->exception_reported) {
> +	    _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred creating message: %s\n",
> +				      error.get_msg().c_str());

is this the right exception message?  seems like it should talk about
removing values rather than "creating message"

> @@ -1114,7 +1144,13 @@ _notmuch_message_set_header_values (notmuch_message_t *message,
>      message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
>  			    Xapian::sortable_serialise (time_value));
>      message->doc.add_value (NOTMUCH_VALUE_FROM, from);
> -    message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
> +
> +    old_subject = message->doc.get_value (NOTMUCH_VALUE_SUBJECT);
> +    if (old_subject.empty())
> +	message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
> +    else
> +	message->doc.add_value (NOTMUCH_VALUE_SUBJECT, old_subject + "\n" + subject);

here we're appending the subject to the tail -- so the first injected
subject line stays at the top.

it looks like it will re-add the same subject line multiple times,
even if already present.  so if i get 3 copies of a message with subject
"foo" then the value slot will be "foo\nfoo\nfoo".  is that desirable?

i think either we care about careful ordering (which strikes me as
delicate and potentially difficult to handle, esp. when you get into the
headers changing depending on whether you index the cleartext or not),
or we should avoid injecting duplicates.

wdyt?

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2018-05-04 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 14:03 subjects and duplicated message id's David Bremner
2017-12-14 14:32 ` [PATCH] test: add known broken test for regexp search of second subject David Bremner
2018-05-03 10:52   ` David Bremner
2017-12-14 16:57 ` subjects and duplicated message id's Daniel Kahn Gillmor
2017-12-15  1:23   ` David Bremner
2017-12-19 14:15     ` WIP, all subjects in value slot David Bremner
2017-12-19 14:15       ` [PATCH] WIP: add all subjects to value David Bremner
2018-05-04 13:48         ` Daniel Kahn Gillmor [this message]
2018-05-07  0:54           ` David Bremner

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://notmuchmail.org/

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

  git send-email \
    --in-reply-to=87k1sjo7jv.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).