mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Only learn from confirmed items
Text classification should only learn from confirmed items. Log if classification is disabled when processing an item.
This commit is contained in:
@ -157,8 +157,9 @@ object RegexNerFile {
|
||||
.reduce(_ ++ fr"UNION ALL" ++ _)
|
||||
|
||||
selectSimple(fr"MAX(t)", fr"(" ++ sql ++ fr") as x", Fragment.empty)
|
||||
.query[Timestamp]
|
||||
.query[Option[Timestamp]]
|
||||
.option
|
||||
.map(_.flatten)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +98,14 @@ object TextAnalysis {
|
||||
ctx: Context[F, Args],
|
||||
cfg: Config.TextAnalysis
|
||||
): OptionT[F, Ident] =
|
||||
if (cfg.classification.enabled)
|
||||
OptionT(ctx.store.transact(RClassifierSetting.findById(ctx.args.meta.collective)))
|
||||
.filter(_.enabled)
|
||||
.mapFilter(_.fileId)
|
||||
else
|
||||
OptionT.none
|
||||
(if (cfg.classification.enabled)
|
||||
OptionT(ctx.store.transact(RClassifierSetting.findById(ctx.args.meta.collective)))
|
||||
.filter(_.enabled)
|
||||
.mapFilter(_.fileId)
|
||||
else
|
||||
OptionT.none[F, Ident]).orElse(
|
||||
OptionT.liftF(ctx.logger.info("Classification is disabled.")) *> OptionT
|
||||
.none[F, Ident]
|
||||
)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user