auto *cache_runtime = C_API_SYMCACHE_RUNTIME(task->symcache_runtime);
auto *real_cache = C_API_SYMCACHE(cache);
+ if (!cache_runtime) {
+ /* XXX: ugly hack to enable classification during learning... */
+ return TRUE;
+ }
+
return cache_runtime->is_symbol_enabled(task, *real_cache, symbol);
}
#include "symcache_runtime.hxx"
#include "unix-std.h"
#include "libutil/cxx/locked_file.hxx"
+#include "libutil/cxx/util.hxx"
#include "fmt/core.h"
#include "contrib/t1ha/t1ha.h"
auto symcache::resort() -> void
{
- auto ord = std::make_shared<order_generation>(filters.size(), cur_order_gen);
+ auto ord = std::make_shared<order_generation>(filters.size() +
+ prefilters.size() +
+ composites.size() +
+ postfilters.size() +
+ idempotent.size() +
+ connfilters.size() +
+ classifiers.size(), cur_order_gen);
for (auto &it: filters) {
if (it) {
append_items_vec(classifiers, ord->d);
/* After sorting is done, we can assign all elements in the by_symbol hash */
- for (auto i = 0; i < ord->size(); i++) {
- const auto &it = ord->d[i];
+ for (const auto [i, it] : rspamd::enumerate(ord->d)) {
ord->by_symbol[it->get_name()] = i;
ord->by_cache_id[it->id] = i;
}
continue;
}
- if (!rspamd_symcache_is_symbol_enabled (task, task->cfg->cache,
+ if (!is_learn && !rspamd_symcache_is_symbol_enabled (task, task->cfg->cache,
st->stcf->symbol)) {
g_ptr_array_index (task->stat_runtimes, i) = NULL;
msg_debug_bayes ("symbol %s is disabled, skip classification",