mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
lib: only trigger phrase processing for regexp fields when needed
The argument is that if the string passed to the field processor has no spaces, then the added quotes won't have any benefit except for disabling wildcards. But disabling wildcards doesn't seem very useful in the normal Xapian query parser, since they're stripped before generating terms anyway. It does mean that the query 'from:"foo*"' will not be precisely equivalent to 'from:foo' as it is for the non field-processor version.
This commit is contained in:
parent
497b83780e
commit
38a56b98f9
2 changed files with 8 additions and 4 deletions
|
@ -158,8 +158,14 @@ RegexpFieldProcessor::operator() (const std::string & str)
|
|||
} else {
|
||||
/* TODO replace this with a nicer API level triggering of
|
||||
* phrase parsing, when possible */
|
||||
std::string quoted='"' + str + '"';
|
||||
return parser.parse_query (quoted, NOTMUCH_QUERY_PARSER_FLAGS, term_prefix);
|
||||
std::string query_str;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -12,12 +12,10 @@ fi
|
|||
notmuch search --output=messages from:cworth > cworth.msg-ids
|
||||
|
||||
test_begin_subtest "xapian wildcard search for from:"
|
||||
test_subtest_known_broken
|
||||
notmuch search --output=messages 'from:cwo*' > OUTPUT
|
||||
test_expect_equal_file cworth.msg-ids OUTPUT
|
||||
|
||||
test_begin_subtest "xapian wildcard search for subject:"
|
||||
test_subtest_known_broken
|
||||
test_expect_equal $(notmuch count 'subject:count*') 1
|
||||
|
||||
test_begin_subtest "regexp from search, case sensitive"
|
||||
|
|
Loading…
Reference in a new issue