dovecot-2.2: fts: fts_no_autofuzzy shouldn't disable fuzzying wh...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 8 13:29:46 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/1ea3da40ea8f
changeset: 17690:1ea3da40ea8f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 08 16:27:40 2014 +0300
description:
fts: fts_no_autofuzzy shouldn't disable fuzzying when FUZZY search parameter is set.

diffstat:

 src/plugins/fts/fts-storage.c |  24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r cdf4edcc6256 -r 1ea3da40ea8f src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Fri Aug 08 16:20:31 2014 +0300
+++ b/src/plugins/fts/fts-storage.c	Fri Aug 08 16:27:40 2014 +0300
@@ -160,6 +160,25 @@
 	return FALSE;
 }
 
+static bool fts_args_have_fuzzy(const struct mail_search_arg *args)
+{
+	for (; args != NULL; args = args->next) {
+		if (args->fuzzy)
+			return TRUE;
+		switch (args->type) {
+		case SEARCH_OR:
+		case SEARCH_SUB:
+		case SEARCH_INTHREAD:
+			if (fts_args_have_fuzzy(args->value.subargs))
+				return TRUE;
+			break;
+		default:
+			break;
+		}
+	}
+	return FALSE;
+}
+
 static struct mail_search_context *
 fts_mailbox_search_init(struct mailbox_transaction_context *t,
 			struct mail_search_args *args,
@@ -194,7 +213,10 @@
 	i_array_init(&fctx->scores->score_map, 64);
 	MODULE_CONTEXT_SET(ctx, fts_storage_module, fctx);
 
-	if (mail_user_plugin_getenv(t->box->storage->user,
+	/* FIXME: we'll assume that all the args are fuzzy. not good,
+	   but would require much more work to fix it. */
+	if (!fts_args_have_fuzzy(args->args) &&
+	    mail_user_plugin_getenv(t->box->storage->user,
 				    "fts_no_autofuzzy") != NULL)
 		fctx->flags |= FTS_LOOKUP_FLAG_NO_AUTO_FUZZY;
 	/* transaction contains the last search's scores. they can be


More information about the dovecot-cvs mailing list