From: Matt Armstrong <marmstrong@google.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] lib: add 'body:' field, stop indexing headers twice.
Date: Mon, 04 Mar 2019 17:26:35 -0800 [thread overview]
Message-ID: <qf5mumaun5g.fsf@naz.kir.corp.google.com> (raw)
In-Reply-To: <20190304022912.13924-1-david@tethera.net>
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 <david@tethera.net> 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);
}
next prev parent reply other threads:[~2019-03-05 1:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 11:56 [PATCH] WIP: add searching by body: David Bremner
2019-02-18 13:06 ` David Bremner
2019-03-04 2:29 ` [PATCH] lib: add 'body:' field, stop indexing headers twice David Bremner
2019-03-05 1:26 ` Matt Armstrong [this message]
2019-03-13 0:47 ` v2. add body: / drop double indexing of headers David Bremner
2019-03-13 0:47 ` [PATCH 1/4] lib: drop comment about only indexing one file David Bremner
2019-03-13 0:47 ` [PATCH 2/4] lib: add clarification about the use of "prefix" in the docs David Bremner
2019-03-13 0:47 ` [PATCH 3/4] lib: update commentary about path/folder terms David Bremner
2019-03-31 17:53 ` David Bremner
2019-03-13 0:47 ` [PATCH 4/4] lib: add 'body:' field, stop indexing headers twice David Bremner
2019-03-13 5:30 ` David Bremner
2019-03-13 11:44 ` [PATCH] " David Bremner
2019-03-19 0:39 ` David Bremner
2019-03-29 13:17 ` David Bremner
2019-04-14 11:32 ` David Bremner
2019-04-17 11:55 ` 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=qf5mumaun5g.fsf@naz.kir.corp.google.com \
--to=marmstrong@google.com \
--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).