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"));
<meta http-equiv="content-type" content="text/html; charset=utf-8">  notmuch->query_parser->add_prefix ("to", _find_prefix ("cc"));
<meta http-equiv="content-type" content="text/html; charset=utf-8">  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
<meta http-equiv="content-type" content="text/html; charset=utf-8">  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@gmail.com> wrote:
On Sun, Dec 12, 2010 at 7:41 AM, Austin Clements <amdragon@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
<font color="#888888">/Joel
</font>