]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix one-shot symbols weight calculations
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 25 Mar 2017 22:16:32 +0000 (22:16 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 25 Mar 2017 22:16:32 +0000 (22:16 +0000)
src/libmime/filter.c
src/lua/lua_task.c

index c95dfc585807fd3eede9a1c1b03f15e5e9b3fa10..8b8ddf309b55f172f6f6363ad299534921bf4f73 100644 (file)
@@ -174,8 +174,8 @@ insert_metric_result (struct rspamd_task *task,
                }
                else {
                        if (fabs (s->score) < fabs (w) && signbit (s->score) == signbit (w)) {
-                               /* Replace less weight with a bigger one */
-                               diff = metric_res->score - s->score + w;
+                               /* Replace less significant weight with a more significant one */
+                               diff = w - s->score;
                        }
                        else {
                                diff = 0;
index d8df34e1e0bb91a8f2a04b117c478ab75d5fbc2a..36272ecfe2d80ec6c94b1087e8e1e891b265c75f 100644 (file)
@@ -3805,6 +3805,8 @@ lua_task_set_metric_score (lua_State *L)
        if (task && metric_name) {
                if ((metric_res =
                        g_hash_table_lookup (task->results, metric_name)) != NULL) {
+                       msg_debug_task ("set metric score from %.2f to %.2f",
+                               metric_res->score, nscore);
                        metric_res->score = nscore;
                        lua_pushboolean (L, true);
                }