From 451f35e178780b4334e6c64ebf195f7b1e812354 Mon Sep 17 00:00:00 2001 From: Jean-Louis Dupond Date: Fri, 11 Aug 2017 14:32:58 +0200 Subject: [PATCH] [Fix] Use weight from map for fuzzy scoring --- src/plugins/fuzzy_check.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 85e6d2c64..5df59e1fe 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1761,6 +1761,7 @@ fuzzy_insert_result (struct fuzzy_client_session *session, const gchar *symbol; struct fuzzy_mapping *map; struct rspamd_task *task = session->task; + double weight; double nval; guchar buf[2048]; const gchar *type = "bin"; @@ -1771,11 +1772,12 @@ fuzzy_insert_result (struct fuzzy_client_session *session, GINT_TO_POINTER (rep->flag))) == NULL) { /* Default symbol and default weight */ symbol = session->rule->symbol; - + weight = session->rule->max_score; } else { /* Get symbol and weight from map */ symbol = map->symbol; + weight = map->weight; } @@ -1785,8 +1787,7 @@ fuzzy_insert_result (struct fuzzy_client_session *session, * Otherwise `value` means error code */ - nval = fuzzy_normalize (rep->value, - session->rule->max_score); + nval = fuzzy_normalize (rep->value, weight); if (io && (io->flags & FUZZY_CMD_FLAG_IMAGE)) { nval *= rspamd_normalize_probability (rep->prob, 0.5); -- 2.39.5