changeset 21444:ae33f73964e8

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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 14 Jan 2017 18:34:11 +0200
parents 2b9164c4299a
children be855523d700
files src/plugins/fts/fts-search-args.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts/fts-search-args.c	Mon Jan 23 18:02:05 2017 +0200
+++ b/src/plugins/fts/fts-search-args.c	Sat Jan 14 18:34:11 2017 +0200
@@ -81,6 +81,11 @@
 		} 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);