From: Timo Sirainen Date: Sat, 14 Jan 2017 16:34:11 +0000 (+0200) Subject: fts: Fix search query generation when tokens are filtered out. X-Git-Tag: 2.3.0.rc1~2261 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=513b045d3cb2325250e74f0a92c144f9307eee44;p=thirdparty%2Fdovecot%2Fcore.git fts: Fix search query generation when tokens are filtered out. For example with English stopwords when searching "foo and bar" it should be equilevant to "foo bar", since "and" is filtered out. --- diff --git a/src/plugins/fts/fts-search-args.c b/src/plugins/fts/fts-search-args.c index fc52498c32..b07ddd7cf4 100644 --- a/src/plugins/fts/fts-search-args.c +++ b/src/plugins/fts/fts-search-args.c @@ -81,6 +81,11 @@ fts_backend_dovecot_expand_tokens(struct fts_filter *filter, } else if (ret < 0) { *error_r = t_strdup_printf("Couldn't filter search token: %s", error); return -1; + } else { + /* The filter dropped the token, which means it was + never even indexed. Ignore this word entirely in the + search query. */ + return 0; } } array_sort(&tokens, i_strcmp_p);