diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-13 19:39:37 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-13 19:39:37 +0400 |
commit | b0ddff4f0d56a877305649a14b902b3f23140b4b (patch) | |
tree | 65a2066d13b480b062b20036280d18321fb91e94 /src/lua | |
parent | 091e84951a2b032bb2930b300ffe43eaf01a304e (diff) | |
download | rspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.tar.gz rspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.zip |
* Add new algorithm based on diff algorithm to compare relatively short text parts
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 4916a50ad..f217ee0b2 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -37,6 +37,7 @@ #include "../classifiers/classifiers.h" #include "../binlog.h" #include "../statfile_sync.h" +#include "../diff.h" extern stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf, const gchar *symbol, struct statfile **st, gboolean try_create); @@ -1368,7 +1369,12 @@ lua_textpart_compare_distance (lua_State * L) } else { if (!part->is_empty && !other->is_empty) { - diff = fuzzy_compare_parts (part, other); + if (part->diff_str != NULL && other->diff_str != NULL) { + diff = compare_diff_distance (part->diff_str, other->diff_str); + } + else { + diff = fuzzy_compare_parts (part, other); + } } else if ((part->is_empty && !other->is_empty) || (!part->is_empty && other->is_empty)) { /* Empty and non empty parts are different */ |