[PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-12 Thread Austin Clements
Add the "exactto", "cc", and "bcc" terms just like you do but *remove*
the "to" term altogether.  Then in notmuch_database_open, after it's added
the usual probabilistic prefixes, do something like
  notmuch->query_parser->add_prefix ("to", _find_prefix ("exactto"));
  notmuch->query_parser->add_prefix ("to", _find_prefix ("cc"));
  notmuch->query_parser->add_prefix ("to", _find_prefix ("bcc"));
I haven't tried this, but I believe the effect will be that a query of the
form to:x will be expanded by the query parser to (exactto:x OR cc:x OR
bcc:x), which should achieve what you want without any database overhead.
 You might also want
  notmuch->query_parser->add_prefix ("to", "XTO");
to maintain some form of backwards compatibility.

On Sun, Dec 12, 2010 at 5:43 AM, Joel Borggr?n-Franck <
joel.borggren.franck at gmail.com> wrote:

> On Sun, Dec 12, 2010 at 7:41 AM, Austin Clements 
> wrote:
> > 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
> twice
> > as many copies of  every address.
> >
>
> Probably. I know nothing of Xapian, how would you solve it?
>
> cheers
> /Joel
>
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-12 Thread Joel Borggrén-Franck
On Sun, Dec 12, 2010 at 7:41 AM, Austin Clements  wrote:
> 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 twice
> as many copies of ?every address.
>

Probably. I know nothing of Xapian, how would you solve it?

cheers
/Joel


[PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-12 Thread Austin Clements
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 twice
as many copies of  every address.

On Wed, Dec 1, 2010 at 3:33 PM, Joel Borggr?n-Franck <
joel.borggren.franck at gmail.com> wrote:

> From: Joel Borggr?n-Franck 
>
> Add headers cc: bcc: and to: to index. Real header to: is searched as
> "exactto:foo at 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[]= {
> { "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 = g_mime_message_get_recipients (mime_message,
> GMIME_RECIPIENT_TYPE_TO);
> +_index_address_list (message, "exactto", addresses);
> +
> +addresses = g_mime_message_get_recipients (mime_message,
> GMIME_RECIPIENT_TYPE_CC);
> +_index_address_list (message, "cc", addresses);
> +
> +addresses = g_mime_message_get_recipients (mime_message,
> GMIME_RECIPIENT_TYPE_BCC);
> +_index_address_list (message, "bcc", addresses);
> +
> addresses = g_mime_message_get_all_recipients (mime_message);
> _index_address_list (message, "to", addresses);
>
> --
> 1.7.3.2
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
-- next part --
An HTML attachment was scrubbed...
URL: 



Re: [PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-12 Thread Austin Clements
Add the exactto, cc, and bcc terms just like you do but *remove*
the to term altogether.  Then in notmuch_database_open, after it's added
the usual probabilistic prefixes, do something like
  notmuch-query_parser-add_prefix (to, _find_prefix (exactto));
  notmuch-query_parser-add_prefix (to, _find_prefix (cc));
  notmuch-query_parser-add_prefix (to, _find_prefix (bcc));
I haven't tried this, but I believe the effect will be that a query of the
form to:x will be expanded by the query parser to (exactto:x OR cc:x OR
bcc:x), which should achieve what you want without any database overhead.
 You might also want
  notmuch-query_parser-add_prefix (to, XTO);
to maintain some form of backwards compatibility.

On Sun, Dec 12, 2010 at 5:43 AM, Joel Borggrén-Franck 
joel.borggren.fra...@gmail.com wrote:

 On Sun, Dec 12, 2010 at 7:41 AM, Austin Clements amdra...@gmail.com
 wrote:
  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
 twice
  as many copies of  every address.
 

 Probably. I know nothing of Xapian, how would you solve it?

 cheers
 /Joel

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


Re: [PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-11 Thread Austin Clements
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 twice
as many copies of  every address.

On Wed, Dec 1, 2010 at 3:33 PM, Joel Borggrén-Franck 
joel.borggren.fra...@gmail.com wrote:

 From: Joel Borggrén-Franck j...@codehouse.se

 Add headers cc: bcc: and to: to index. Real header to: is searched as
 exactto:f...@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[]= {
 { 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 = g_mime_message_get_recipients (mime_message,
 GMIME_RECIPIENT_TYPE_TO);
 +_index_address_list (message, exactto, addresses);
 +
 +addresses = g_mime_message_get_recipients (mime_message,
 GMIME_RECIPIENT_TYPE_CC);
 +_index_address_list (message, cc, addresses);
 +
 +addresses = g_mime_message_get_recipients (mime_message,
 GMIME_RECIPIENT_TYPE_BCC);
 +_index_address_list (message, bcc, addresses);
 +
 addresses = 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

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


[PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-03 Thread Xavier Maillard
Hi,

On Thu, 02 Dec 2010 09:48:03 -0800, Dirk Hohndel  
wrote:
> On Wed,  1 Dec 2010 21:33:55 +0100, Joel Borggr?n-Franck 
>  wrote:
> > From: Joel Borggr?n-Franck 
> > 
> > Add headers cc: bcc: and to: to index. Real header to: is searched as
> > "exactto:foo at 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.
> 
> cworth has been talking for a while about changing notmuch to index all
> of the headers - this is one of my key missing features at this point. 
> Searching for Sender: or X-Mailing-List: or (PLEASE) X-Spam-Score:

I second that ! I also need this feature (so sad I can't do it myself)


[PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-02 Thread Dirk Hohndel
On Wed,  1 Dec 2010 21:33:55 +0100, Joel Borggr?n-Franck  wrote:
> From: Joel Borggr?n-Franck 
> 
> Add headers cc: bcc: and to: to index. Real header to: is searched as
> "exactto:foo at 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.

cworth has been talking for a while about changing notmuch to index all
of the headers - this is one of my key missing features at this point. 
Searching for Sender: or X-Mailing-List: or (PLEASE) X-Spam-Score:

/D


Re: [PATCH] add headers cc: bcc: and to: (as exactto:) to search index

2010-12-02 Thread Dirk Hohndel
On Wed,  1 Dec 2010 21:33:55 +0100, Joel Borggrén-Franck 
joel.borggren.fra...@gmail.com wrote:
 From: Joel Borggrén-Franck j...@codehouse.se
 
 Add headers cc: bcc: and to: to index. Real header to: is searched as
 exactto:f...@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.

cworth has been talking for a while about changing notmuch to index all
of the headers - this is one of my key missing features at this point. 
Searching for Sender: or X-Mailing-List: or (PLEASE) X-Spam-Score:

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