]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Fix search query generation when tokens are filtered out.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 14 Jan 2017 16:34:11 +0000 (18:34 +0200)
committerGitLab <gitlab@git.dovecot.net>
Wed, 25 Jan 2017 15:43:27 +0000 (17:43 +0200)
For example with English stopwords when searching "foo and bar" it should
be equilevant to "foo bar", since "and" is filtered out.

src/plugins/fts/fts-search-args.c

index fc52498c32e5e5a7b0c2364ff3be575ecd43cce1..b07ddd7cf422cc91c81d4ce6b7b4ee52bac61142 100644 (file)
@@ -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);