unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@gmail.com>
To: Mark Anderson <MarkR.Anderson@amd.com>
Cc: notmuch@notmuchmail.org
Subject: Re: Strange match to my query
Date: Tue, 25 Jan 2011 19:51:14 -0500	[thread overview]
Message-ID: <AANLkTikzBkHoTUO41byUrZrTPk1YUgG+rDPKtsTSq2sy@mail.gmail.com> (raw)
In-Reply-To: <3wd4o8wa7fx.fsf@testarossa.amd.com>

[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]

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
  c:1 hello:2 com:3 K:1 R:2 world:3 com:4
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.

[1] Your to:\'$WORD1@$WORD2\' query didn't work because Xapian doesn't
accept a single quote after a prefix.

On Tue, Jan 25, 2011 at 6:29 PM, Mark Anderson <MarkR.Anderson@amd.com>wrote:

> Hi guys, What's up? ("Notmuch")
>
> Apparently matching on email addresses doesn't work the way I hoped.
>
> While debugging why my to:x@y.com <to%3Ax@y.com> search was matching far
> too many
> entries, I whittled it down to this:
>
> WORD1=hello
> WORD2=goodbye
> MSGID=junk$(date +%s)
> TESTDIR=$(notmuch config get database.path)/.tmp/new
> TESTMAIL=$TESTDIR/$MSGID:2,
>
> mkdir -p $TESTDIR
>
> echo Testcase for $WORD1@$WORD2, msgid: $MSGID@junk.com
>
> echo "From: nobody@nobody.com
> To: c@${WORD1}.com, K-R@${WORD2}.com
> Date: Mon, 24 Jan 2011 23:41:34 -0600
> Subject: Error
> Message-ID: <$MSGID@junk.com>
>
> Not empty body.=
>
> " > $TESTMAIL
>
> notmuch new
> notmuch search --output=files to:$WORD1@$WORD2
> notmuch search --output=files to:\"$WORD1@$WORD2\"
>
> Why does that match, but this doesn't?
>
> notmuch search --output=files to:\'$WORD1@$WORD2\'
>
> Apparently single quotes are the only quote for Xapian's parser?
>
> I guess this is a strong vote for the quick integration of the custom
> parser with optimization passes that turn emails into phrases that can't
> match across multiple emails.
>
> This was just an egregious example of notmuch giving me notmuch of what
> I wanted, or actually, far too much of what I didn't want.
>
> Thanks,
> -Mark
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

[-- Attachment #2: Type: text/html, Size: 3023 bytes --]

  reply	other threads:[~2011-01-26  0:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25 23:29 Strange match to my query Mark Anderson
2011-01-26  0:51 ` Austin Clements [this message]
2011-01-26  2:19   ` Carl Worth
2011-01-26  5:59     ` Carl Worth
2011-01-26 17:02       ` Mark Anderson
2011-02-25 18:19 ` Jameson Rollins
2011-02-25 20:57   ` Mark Anderson
2011-02-25 21:29     ` Jameson Rollins
2011-03-01 23:00       ` Mark Anderson
2011-03-01 23:15         ` Jameson Rollins
2011-03-01 23:40           ` Mark Anderson
2011-04-14  7:32           ` Florian Friesdorf
2011-04-19  6:21             ` Jameson Graef Rollins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikzBkHoTUO41byUrZrTPk1YUgG+rDPKtsTSq2sy@mail.gmail.com \
    --to=amdragon@gmail.com \
    --cc=MarkR.Anderson@amd.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).