[PATCH v2] test/search: add check for slightly trick search

Austin Clements amdragon at MIT.EDU
Wed May 4 14:26:36 PDT 2011


Quoth Felipe Contreras on May 04 at 11:54 pm:
> On Wed, May 4, 2011 at 11:46 PM, Austin Clements <amdragon at mit.edu> wrote:
> > On Wed, May 4, 2011 at 4:26 PM, Felipe Contreras
> > <felipe.contreras at gmail.com> wrote:
> >> +output=$(notmuch search from:'search-by-from@' | notmuch_search_sanitize)
> >
> > I don't think this does what you think it does.  Xapian only
> > understands double quotes around phrases, not single quotes.
> > Furthermore, a single quote after a prefix prevents that token from
> > acting as a prefix, so you search is finding messages containing the
> > *word* "from" and the phrase "search by from" *anywhere* (which is a
> > phrase not because of the quotes, but because of the hyphens).
> >
> > The test results happen to be the same if you use single quotes or
> > double quotes, but for very different reasons.
> 
> Ok, how about:
> search from:search-by-from@
> 
> Would that be better?

from:"search-by-from@" would be the fail-safe, since that's clearly a
prefixed phrase query in Xapian syntax.  from:search-by-from@ depends
on the parsing of @, which is precisely what I think you're proposing
should be changed (though your commit message talks about hyphens, not
@), so in some sense from:search-by-from@ is up to you.  It probably
*should* work, given that @ happens to be classified the same way as
hyphen by the Xapian parser (or, in the custom query parser, because @
isn't whitespace).


More information about the notmuch mailing list