<div>Well-constructed test message. �Xapian's query parser is actually doing the right thing [1] and this is a bug in the way notmuch indexes address list headers. �For each address, _notmuch_message_gen_terms resets the term generator's term position, so your To header indexes with positions as</div>
<div>��c:1 hello:2 com:3 K:1 R:2 world:3 com:4</div><div>Thus, the phrase query "hello world" matches hello in position 2 and world in position 3. �Probably the right thing for notmuch to do is to jump up the term generator position between each address so phrase queries don't cross them or span them.</div>
<div><br></div><div>[1] Your to:\'$WORD1@$WORD2\' query didn't work because Xapian doesn't accept a single quote after a prefix.</div><br><div class="gmail_quote">On Tue, Jan 25, 2011 at 6:29 PM, Mark Anderson <span dir="ltr"><<a href="mailto:MarkR.Anderson@amd.com">MarkR.Anderson@amd.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi guys, What's up? ("Notmuch")<br>
<br>
Apparently matching on email addresses doesn't work the way I hoped.<br>
<br>
While debugging why my <a href="mailto:to%3Ax@y.com">to:x@y.com</a> search was matching far too many<br>
entries, I whittled it down to this:<br>
<br>
WORD1=hello<br>
WORD2=goodbye<br>
MSGID=junk$(date +%s)<br>
TESTDIR=$(notmuch config get database.path)/.tmp/new<br>
TESTMAIL=$TESTDIR/$MSGID:2,<br>
<br>
mkdir -p $TESTDIR<br>
<br>
echo Testcase for $WORD1@$WORD2, msgid: $<a href="mailto:MSGID@junk.com">MSGID@junk.com</a><br>
<br>
echo "From: <a href="mailto:nobody@nobody.com">nobody@nobody.com</a><br>
To: c@${WORD1}.com, K-R@${WORD2}.com<br>
Date: Mon, 24 Jan 2011 23:41:34 -0600<br>
Subject: Error<br>
Message-ID: <$<a href="mailto:MSGID@junk.com">MSGID@junk.com</a>><br>
<br>
Not empty body.=<br>
<br>
" > $TESTMAIL<br>
<br>
notmuch new<br>
notmuch search --output=files to:$WORD1@$WORD2<br>
notmuch search --output=files to:\"$WORD1@$WORD2\"<br>
<br>
Why does that match, but this doesn't?<br>
<br>
notmuch search --output=files to:\'$WORD1@$WORD2\'<br>
<br>
Apparently single quotes are the only quote for Xapian's parser?<br>
<br>
I guess this is a strong vote for the quick integration of the custom<br>
parser with optimization passes that turn emails into phrases that can't<br>
match across multiple emails.<br>
<br>
This was just an egregious example of notmuch giving me notmuch of what<br>
I wanted, or actually, far too much of what I didn't want.<br>
<br>
Thanks,<br>
-Mark<br>
<br>
_______________________________________________<br>
notmuch mailing list<br>
<a href="mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a><br>
<a href="http://notmuchmail.org/mailman/listinfo/notmuch" target="_blank">http://notmuchmail.org/mailman/listinfo/notmuch</a><br>
</blockquote></div><br>