[PATCH RFC] index: add body: search query term

David Bremner david at tethera.net
Wed Oct 10 03:43:11 PDT 2018


William Casarin <jb55 at jb55.com> writes:

>
>  lib/database.cc | 3 +++
>  lib/index.cc    | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/database.cc b/lib/database.cc
> index 9cf8062c..0b085b21 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -297,6 +297,9 @@ prefix_t prefix_table[] = {
>      { "subject",		"XSUBJECT",	NOTMUCH_FIELD_EXTERNAL |
>  						NOTMUCH_FIELD_PROBABILISTIC |
>  						NOTMUCH_FIELD_PROCESSOR},
> +    { "body",			"XBODY",	NOTMUCH_FIELD_EXTERNAL |
> +						NOTMUCH_FIELD_PROBABILISTIC |
> +						NOTMUCH_FIELD_PROCESSOR},
>  };
>  
>  static void
> diff --git a/lib/index.cc b/lib/index.cc
> index 3f694387..299b8770 100644
> --- a/lib/index.cc
> +++ b/lib/index.cc
> @@ -506,7 +506,7 @@ _index_mime_part (notmuch_message_t *message,
>      body = (char *) g_byte_array_free (byte_array, false);
>  
>      if (body) {
> -	_notmuch_message_gen_terms (message, NULL, body);
> +	_notmuch_message_gen_terms (message, "body", body);
>  
>  	free (body);
>      }
> -- 

I think you'll find you broke non-prefixed queries. Does the test suite
still pass? If so, we need more tests. Anyway, if you add a second set
of terms I'd be intersted how much this bloats the index. Ideally with
the performance corpus so we can all reproduce the experiment.

d


More information about the notmuch mailing list