From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 58BC8431FB6 for ; Sat, 11 Dec 2010 22:41:20 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.798 X-Spam-Level: X-Spam-Status: No, score=-0.798 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kwFQWFOED6bU for ; Sat, 11 Dec 2010 22:41:18 -0800 (PST) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) by olra.theworths.org (Postfix) with ESMTP id DBC59431FB5 for ; Sat, 11 Dec 2010 22:41:17 -0800 (PST) Received: by qwe5 with SMTP id 5so5614323qwe.26 for ; Sat, 11 Dec 2010 22:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=llB8BCqwR/r5jhLhdb2Q6t7G6dKIXiNFXmrv3naNLkk=; b=m82jRWVNMKoO8lr85WEWPUrzMqpFS0MpQyJeheFnoKzDmRERT+fMHVoHtjwNkF3iWl +4W3I5bgH4CJhDUWEn/NhFXwjtgTbPCXLF1fMB9sZJlF0C59LJwRgG5p3AwG/2FFTkm9 2faC7QpS9HUSr9o5lRQF+EIDXZ2PReWysGGmQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=WW84QZgBosom94dpMRGIPKavmXRKKiax4MbXMgeQNcWaNNyeF+5bn2RO/rrjvpxn2e 4BD1GHdwW9UuWHNRr9yGLCMMuvZNwcIbz7T8J8iH8Ti/5eaBBbIVyXWRbd1AdT4EaGwH vtcM0E8Wag/97GeVaDGaKEBwV4CiO6ZkwGhb0= MIME-Version: 1.0 Received: by 10.229.235.4 with SMTP id ke4mr2483152qcb.201.1292136074473; Sat, 11 Dec 2010 22:41:14 -0800 (PST) Received: by 10.229.224.202 with HTTP; Sat, 11 Dec 2010 22:41:14 -0800 (PST) In-Reply-To: <1291235635-16523-1-git-send-email-joel.borggren.franck@gmail.com> References: <1291235635-16523-1-git-send-email-joel.borggren.franck@gmail.com> Date: Sun, 12 Dec 2010 01:41:14 -0500 Message-ID: Subject: Re: [PATCH] add headers cc: bcc: and to: (as exactto:) to search index From: Austin Clements To: =?ISO-8859-1?Q?Joel_Borggr=E9n=2DFranck?= Content-Type: multipart/alternative; boundary=0016e6465148b87303049730dfea Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Sun, 12 Dec 2010 06:41:21 -0000 --0016e6465148b87303049730dfea Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Short of full header indexing, wouldn't a better way to achieve this be to store only the "to" header as "XTO", the "cc" header "XCC", and the "bcc" header as "XBCC" and use Xapian's multi-prefix support to map the "to:" query prefix to "XTO", "XCC", and "XBCC"? That way you're not storing twic= e as many copies of every address. On Wed, Dec 1, 2010 at 3:33 PM, Joel Borggr=E9n-Franck < joel.borggren.franck@gmail.com> wrote: > From: Joel Borggr=E9n-Franck > > Add headers cc: bcc: and to: to index. Real header to: is searched as > "exactto:foo@bar.baz" and search term "to:" is kept as a union of cc:, > bcc: and to: for backward compatibility. Use search term "cc:" resp. > "bcc:" to search those headers respectively. > --- > lib/database.cc | 11 +++++++---- > lib/index.cc | 9 +++++++++ > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/lib/database.cc b/lib/database.cc > index 7a00917..68910f3 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -88,9 +88,9 @@ typedef struct { > * MESSAGE_ID: The unique ID of the mail mess (see "id" above) > * > * In addition, terms from the content of the message are added with > - * "from", "to", "attachment", and "subject" prefixes for use by the > - * user in searching. But the database doesn't really care itself > - * about any of these. > + * "from", "to", "exactto", "cc", "bbc", "attachment" and "subject" > + * prefixes for use by the user in searching. But the database doesn't > + * really care itself about any of these. > * > * The data portion of a mail document is empty. > * > @@ -204,7 +204,10 @@ static prefix_t PROBABILISTIC_PREFIX[]=3D { > { "from", "XFROM" }, > { "to", "XTO" }, > { "attachment", "XATTACHMENT" }, > - { "subject", "XSUBJECT"} > + { "subject", "XSUBJECT"}, > + { "exactto", "XEXACTTO"}, > + { "cc", "XCC"}, > + { "bcc", "XBCC"}, > }; > > int > diff --git a/lib/index.cc b/lib/index.cc > index 00478f8..d59c255 100644 > --- a/lib/index.cc > +++ b/lib/index.cc > @@ -455,6 +455,15 @@ _notmuch_message_index_file (notmuch_message_t > *message, > > _index_address_list (message, "from", addresses); > > + addresses =3D g_mime_message_get_recipients (mime_message, > GMIME_RECIPIENT_TYPE_TO); > + _index_address_list (message, "exactto", addresses); > + > + addresses =3D g_mime_message_get_recipients (mime_message, > GMIME_RECIPIENT_TYPE_CC); > + _index_address_list (message, "cc", addresses); > + > + addresses =3D g_mime_message_get_recipients (mime_message, > GMIME_RECIPIENT_TYPE_BCC); > + _index_address_list (message, "bcc", addresses); > + > addresses =3D g_mime_message_get_all_recipients (mime_message); > _index_address_list (message, "to", addresses); > > -- > 1.7.3.2 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch > --0016e6465148b87303049730dfea Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Short of full header indexing, wouldn't a better way to achieve this be= to store only the "to" header as "XTO", the "cc&q= uot; header "XCC", and the "bcc" header as "XBCC&q= uot; and use Xapian's multi-prefix support to map the "to:" q= uery prefix to "XTO", "XCC", and "XBCC"? =A0T= hat way you're not storing twice as many copies of =A0every address.
On Wed, Dec 1, 2010 at 3:33 PM, Joel Borggr= =E9n-Franck <joel.borggren.franck@gmail.com> wrote:
From: Joel Borggr=E9n-Franck <jbf@co= dehouse.se>

Add headers cc: bcc: and to: to index. Real header to: is searched as
"exactto:foo@bar.baz" and search term "to:" is kept as = a union of cc:,
bcc: and to: for backward compatibility. Use search term "cc:" re= sp.
"bcc:" to search those headers respectively.
---
=A0lib/database.cc | =A0 11 +++++++----
=A0lib/index.cc =A0 =A0| =A0 =A09 +++++++++
=A02 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 7a00917..68910f3 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -88,9 +88,9 @@ typedef struct {
=A0* =A0 =A0 MESSAGE_ID: =A0 =A0 The unique ID of the mail mess (see "= ;id" above)
=A0*
=A0* In addition, terms from the content of the message are added with
- * "from", "to", "attachment", and "sub= ject" prefixes for use by the
- * user in searching. But the database doesn't really care itself
- * about any of these.
+ * "from", "to", "exactto", "cc", = "bbc", "attachment" and "subject"
+ * prefixes for use by the user in searching. But the database doesn't=
+ * really care itself about any of these.
=A0*
=A0* The data portion of a mail document is empty.
=A0*
@@ -204,7 +204,10 @@ static prefix_t PROBABILISTIC_PREFIX[]=3D {
=A0 =A0 { "from", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"XFROM= " },
=A0 =A0 { "to", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"XTO= " },
=A0 =A0 { "attachment", =A0 =A0 =A0 =A0 =A0 =A0"XATTACHMENT= " },
- =A0 =A0{ "subject", =A0 =A0 =A0 =A0 =A0 =A0 =A0 "XSUBJECT&= quot;}
+ =A0 =A0{ "subject", =A0 =A0 =A0 =A0 =A0 =A0 =A0 "XSUBJECT&= quot;},
+ =A0 =A0{ "exactto", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"XEXACT= TO"},
+ =A0 =A0{ "cc", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "XC= C"},
+ =A0 =A0{ "bcc", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"XB= CC"},
=A0};

=A0int
diff --git a/lib/index.cc b/lib/index.cc
index 00478f8..d59c255 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -455,6 +455,15 @@ _notmuch_message_index_file (notmuch_message_t *messag= e,

=A0 =A0 _index_address_list (message, "from", addresses);

+ =A0 =A0addresses =3D g_mime_message_get_recipients (mime_message, GMIME_R= ECIPIENT_TYPE_TO);
+ =A0 =A0_index_address_list (message, "exactto", addresses);
+
+ =A0 =A0addresses =3D g_mime_message_get_recipients (mime_message, GMIME_R= ECIPIENT_TYPE_CC);
+ =A0 =A0_index_address_list (message, "cc", addresses);
+
+ =A0 =A0addresses =3D g_mime_message_get_recipients (mime_message, GMIME_R= ECIPIENT_TYPE_BCC);
+ =A0 =A0_index_address_list (message, "bcc", addresses);
+
=A0 =A0 addresses =3D g_mime_message_get_all_recipients (mime_message); =A0 =A0 _index_address_list (message, "to", addresses);

--
1.7.3.2

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

--0016e6465148b87303049730dfea--