}
/* First try to find block in chain */
if (block->hash1 == h1 && block->hash2 == h2) {
+ msg_debug ("%s found existing block %ud in chain %ud, value %.2f",
+ file->filename,
+ i,
+ blocknum,
+ value);
block->value = value;
return;
}
/* Check whether we have a free block in chain */
if (block->hash1 == 0 && block->hash2 == 0) {
/* Write new block here */
- msg_debug ("found free block %ud in chain %ud, set h1=%ud, h2=%ud",
+ msg_debug ("%s found free block %ud in chain %ud, set h1=%ud, h2=%ud",
+ file->filename,
i,
blocknum,
h1,
static GList*
rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
struct rspamd_task *task, struct rspamd_tokenizer_runtime *tklist,
- lua_State *L, gboolean learn, GError **err)
+ lua_State *L, gboolean learn, gboolean spam, GError **err)
{
struct rspamd_classifier_config *clcf;
struct rspamd_statfile_config *stcf;
while (curst != NULL) {
stcf = (struct rspamd_statfile_config *)curst->data;
+ /* On learning skip statfiles that do not belong to class */
+ if (learn && (spam != stcf->is_spam)) {
+ curst = g_list_next (curst);
+ continue;
+ }
+
bk = rspamd_stat_get_backend (stcf->backend);
if (bk == NULL) {
cl_runtime->start_pos = start_pos;
cl_runtime->end_pos = end_pos;
+ msg_debug ("added runtime for %s classifier from %ud to %ud",
+ clcf->name, start_pos, end_pos);
+
start_pos = end_pos;
/* Next classifier */
}
/* Initialize classifiers and statfiles runtime */
- if ((cl_runtimes = rspamd_stat_preprocess (st_ctx, task, tklist, L, FALSE, err))
- == NULL) {
+ if ((cl_runtimes = rspamd_stat_preprocess (st_ctx, task, tklist, L,
+ FALSE, FALSE, err)) == NULL) {
return FALSE;
}
}
/* Initialize classifiers and statfiles runtime */
- if ((cl_runtimes = rspamd_stat_preprocess (st_ctx, task, tklist, L, TRUE, err))
- == NULL) {
+ if ((cl_runtimes = rspamd_stat_preprocess (st_ctx, task, tklist, L,
+ TRUE, spam, err)) == NULL) {
return FALSE;
}
if (cl_ctx != NULL) {
if (cl_run->cl->learn_spam_func (cl_ctx, cl_run->tok->tokens,
cl_run, task, spam, err)) {
+ msg_debug ("learned %s classifier %s", spam ? "spam" : "ham",
+ cl_run->clcf->name);
ret = TRUE;
cbdata.classifier_runtimes = cur;