diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-31 19:42:21 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-31 19:42:21 +0400 |
commit | a9c4a7af9415b57397687bd3005dfcd96a01881d (patch) | |
tree | 3aba3246cfe4284ed40ed14c2e1a1d59518de30c /src/fuzzy.c | |
parent | b227b759d6775b4ad3dc1a9739e16ed93e0e345e (diff) | |
download | rspamd-a9c4a7af9415b57397687bd3005dfcd96a01881d.tar.gz rspamd-a9c4a7af9415b57397687bd3005dfcd96a01881d.zip |
* Make fuzzy storage working (tested checking, adding and deleting of fuzzy hashes from storage)
* Fix stupid bug in fuzzy distance calculations
Diffstat (limited to 'src/fuzzy.c')
-rw-r--r-- | src/fuzzy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fuzzy.c b/src/fuzzy.c index 9e49649aa..cb595a9ab 100644 --- a/src/fuzzy.c +++ b/src/fuzzy.c @@ -268,7 +268,7 @@ fuzzy_compare_hashes (fuzzy_hash_t *h1, fuzzy_hash_t *h2) /* If we have hashes of different size, input strings are too different */ if (h1->block_size != h2->block_size) { - return 100; + return 0; } l1 = strlen (h1->hash_pipe); @@ -279,7 +279,7 @@ fuzzy_compare_hashes (fuzzy_hash_t *h1, fuzzy_hash_t *h2) } res = lev_distance (h1->hash_pipe, l1, h2->hash_pipe, l2); - res = (res * 100) / (l1 + l2); + res = 100 - (2 * res * 100) / (l1 + l2); return res; } |