From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3TdB9XAoKB846uB6CDB87008805y.w8678D6Ew178D6Ew16u25.8B0@flex--marmstrong.bounces.google.com> Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2CE7A6DE0C45 for ; Mon, 4 Mar 2019 17:26:39 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -7.802 X-Spam-Level: X-Spam-Status: No, score=-7.802 tagged_above=-999 required=5 tests=[AWL=-0.102, DKIMWL_WL_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3OyLhY3JcYLM for ; Mon, 4 Mar 2019 17:26:38 -0800 (PST) Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by arlo.cworth.org (Postfix) with ESMTPS id 3F3216DE0314 for ; Mon, 4 Mar 2019 17:26:38 -0800 (PST) Received: by mail-pg1-f201.google.com with SMTP id 2so6812325pgg.21 for ; Mon, 04 Mar 2019 17:26:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to; bh=ZTWVl+YrOt7O4Nx/7OPv7z7+bGPv9NI5dZL9K6dJv3k=; b=aJeiZN91PlNFGmFF7GAvVqOLxLyyQX2ho6a8hTAgozRRVjoUVb2ORghZCTw6jbCpT6 dtNbLkBAjb7qxlyMpC29SrddcLONJBTlJRLjWcx5uBEMeveXaRbholzk1msno/bV/rKp UZVnLXcSrx8W5cAWCRZz673B0EcVYCBv5NMkY10+emAxwnB8lANyg2ktTFh0z/sLSgu2 LiP6Yk8g9qSosqyswQ50DbZ5WjcNKtioqxtoiKZlZy5wWLNwsfU8B/enKxLs54eNPVjB i4xNBx/TUzGKg1xZwGTefZ52T0vQIO4MBQfuXdyhDGtaV5Q33+aNGMZhC3am04aakycq h3hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=ZTWVl+YrOt7O4Nx/7OPv7z7+bGPv9NI5dZL9K6dJv3k=; b=c1WCbU2Dj6IX0PfXwWxxTiD0mv9Ytzfpgr35CKfhExtAmfxk4M9dbh08dx0CWSd7EE mnnmlFDqq/TxGvlTdOanEdi0eDQedSvZCrYMupepCP96eIb84k8hmI2w7RhJq/pTmwE6 jWzrpVareQugls95gSACCUWcjOC13sANoq+58OJOILryBYd+4eOlJWqxK/ahXMQPQSxu zGmP5/vvrdv4z0jTipqKngj932/LOW4UrO8NxvDSeSQtbezxCjdkT0X7Z7uXJd+2zXyZ irDmMGfqi8T2rPQiggQHN6G+kQKcnmx0norAvW2T+mpT1KzIY/VCjwVhdF2+W0whdPpk 3M1A== X-Gm-Message-State: AHQUAubCPcUsmCDz4LlAhs1RrEoez5QX/1Yph4nDdcmyuH7hWfSpYk8O UVuMHJm7kmKPM+FdnAG6/j/4ia8obqGuyps6 X-Google-Smtp-Source: AHgI3IYM0vlZ37DtMPejP2jJelX7SeeH3gF3WEutXHTomp168h4wqe5DT5ehrre/cZLAwCyud8elba15U+wC3rez X-Received: by 2002:a62:475b:: with SMTP id u88mr8115215pfa.18.1551749197792; Mon, 04 Mar 2019 17:26:37 -0800 (PST) Date: Mon, 04 Mar 2019 17:26:35 -0800 In-Reply-To: <20190304022912.13924-1-david@tethera.net> Message-Id: Mime-Version: 1.0 References: <20190218115622.31466-1-david@tethera.net> <20190304022912.13924-1-david@tethera.net> Subject: Re: [PATCH] lib: add 'body:' field, stop indexing headers twice. From: Matt Armstrong To: David Bremner , notmuch@notmuchmail.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 01:26:39 -0000 David, interesting idea. I'm not very familiar with this code or its conventions so my feedback should be taken with that in mind. More below. David Bremner writes: > diff --git a/lib/database.cc b/lib/database.cc > index 9cf8062c..27c2d042 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -259,6 +259,8 @@ prefix_t prefix_table[] = { > { "directory", "XDIRECTORY", NOTMUCH_FIELD_NO_FLAGS }, > { "file-direntry", "XFDIRENTRY", NOTMUCH_FIELD_NO_FLAGS }, > { "directory-direntry", "XDDIRENTRY", NOTMUCH_FIELD_NO_FLAGS }, > + { "body", "", NOTMUCH_FIELD_EXTERNAL | > + NOTMUCH_FIELD_PROBABILISTIC}, > { "thread", "G", NOTMUCH_FIELD_EXTERNAL | > NOTMUCH_FIELD_PROCESSOR }, > { "tag", "K", NOTMUCH_FIELD_EXTERNAL | Above this new code in database.cc there is a comment describing the schema. E.g. "Mail document" describes id:, thread:, etc. Add a description of body: there? Also, near those comments there is a double-space in the phrase 'uniquely identified by its "id" field' that you might fix while you're nearby. > diff --git a/lib/message.cc b/lib/message.cc > index 6f2f6345..64349f83 100644 > --- a/lib/message.cc > +++ b/lib/message.cc > @@ -1443,13 +1443,13 @@ _notmuch_message_gen_terms (notmuch_message_t *message, > message->termpos = term_gen->get_termpos () + 100; > > _notmuch_message_invalidate_metadata (message, prefix_name); > + } else { > + term_gen->set_termpos (message->termpos); > + term_gen->index_text (text); > + /* Create a term gap, as above. */ > + message->termpos = term_gen->get_termpos () + 100; > } > > - term_gen->set_termpos (message->termpos); > - term_gen->index_text (text); > - /* Create a term gap, as above. */ > - message->termpos = term_gen->get_termpos () + 100; > - > return NOTMUCH_PRIVATE_STATUS_SUCCESS; > } Instead of the above I think I find what follows more clear. This makes it obvious which logic depends on the presence of a prefix and which logic does not, which was a question I immediately had reading the code. term_gen->set_termpos(message->termpos); if (prefix_name) { term_gen->index_text (text, 1, _find_prefix (prefix_name)); } else { term_gen->index_text (text); } /* Create a gap between this an the next terms so they don't appear to be a * phrase. */ message->termpos = term_gen->get_termpos () + 100; if (prefix_name) { _notmuch_message_invalidate_metadata (message, prefix_name); }