xapian parser bug?

Olly Betts olly at survex.com
Sun Sep 30 13:43:27 PDT 2018


On Sun, Sep 30, 2018 at 09:05:25AM -0300, David Bremner wrote:
>             if (str.find (' ') != std::string::npos)
> 		query_str = '"' + str + '"';
> 	    else
> 		query_str = str;
> 
> 	    return parser.parse_query (query_str, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix);

I wouldn't recommend trying to generate strings to feed to QueryParser
like this code seems to be doing.  QueryParser aims to parse input from
humans not machines.

As well as the case where str is an operation name, the code above looks
like it will mishandle cases where str contains a tab or double quotes.
There are likely other problem cases too.

Cheers,
    Olly


More information about the notmuch mailing list