diff --git a/modules/joex/src/main/resources/reference.conf b/modules/joex/src/main/resources/reference.conf index a495ea5a..378f0b9c 100644 --- a/modules/joex/src/main/resources/reference.conf +++ b/modules/joex/src/main/resources/reference.conf @@ -319,6 +319,10 @@ docspell.joex { # This has only any effect, if mode != disabled. clear-interval = "15 minutes" + # Restricts proposals for due dates. Only dates earlier than this + # number of years in the future are considered. + max-due-date-years = 10 + regex-ner { # Whether to enable custom NER annotation. This uses the # address book of a collective as input for NER tagging (to @@ -517,13 +521,6 @@ docspell.joex { } } - # General config for processing documents - processing { - # Restricts proposals for due dates. Only dates earlier than this - # number of years in the future are considered. - max-due-date-years = 10 - } - # The same section is also present in the rest-server config. It is # used when submitting files into the job queue for processing. # diff --git a/modules/joex/src/main/scala/docspell/joex/Config.scala b/modules/joex/src/main/scala/docspell/joex/Config.scala index 4ad72d7c..922e83c7 100644 --- a/modules/joex/src/main/scala/docspell/joex/Config.scala +++ b/modules/joex/src/main/scala/docspell/joex/Config.scala @@ -31,8 +31,7 @@ case class Config( sendMail: MailSendConfig, files: Files, mailDebug: Boolean, - fullTextSearch: Config.FullTextSearch, - processing: Config.Processing + fullTextSearch: Config.FullTextSearch ) object Config { @@ -55,8 +54,6 @@ object Config { final case class Migration(indexAllChunk: Int) } - case class Processing(maxDueDateYears: Int) - case class TextAnalysis( maxLength: Int, workingDir: Path, @@ -84,7 +81,12 @@ object Config { ) } - case class NlpConfig(mode: NlpMode, clearInterval: Duration, regexNer: RegexNer) + case class NlpConfig( + mode: NlpMode, + clearInterval: Duration, + maxDueDateYears: Int, + regexNer: RegexNer + ) case class RegexNer(maxEntries: Int, fileCacheTime: Duration) diff --git a/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala b/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala index fa484772..1bb91af1 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala @@ -20,7 +20,7 @@ object FindProposal { type Args = ProcessItemArgs def apply[F[_]: Sync]( - cfg: Config.Processing + cfg: Config.TextAnalysis )(data: ItemData): Task[F, Args, ItemData] = Task { ctx => val rmas = data.metas.map(rm => rm.copy(nerlabels = removeDuplicates(rm.nerlabels))) @@ -102,7 +102,7 @@ object FindProposal { } def processAttachment[F[_]: Sync]( - cfg: Config.Processing, + cfg: Config.TextAnalysis, rm: RAttachmentMeta, rd: Vector[NerDateLabel], ctx: Context[F, ProcessItemArgs] @@ -114,11 +114,11 @@ object FindProposal { } def makeDateProposal[F[_]: Sync]( - cfg: Config.Processing, + cfg: Config.TextAnalysis, dates: Vector[NerDateLabel] ): F[MetaProposalList] = Timestamp.current[F].map { now => - val maxFuture = now.plus(Duration.years(cfg.maxDueDateYears.toLong)) + val maxFuture = now.plus(Duration.years(cfg.nlp.maxDueDateYears.toLong)) val latestFirst = dates .filter(_.date.isBefore(maxFuture.toUtcDate)) .sortWith((l1, l2) => l1.date.isAfter(l2.date)) diff --git a/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala b/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala index b6cc493e..c119b467 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala @@ -41,7 +41,7 @@ object ProcessItem { regexNer: RegexNerFile[F] )(item: ItemData): Task[F, ProcessItemArgs, ItemData] = TextAnalysis[F](cfg.textAnalysis, analyser, regexNer)(item) - .flatMap(FindProposal[F](cfg.processing)) + .flatMap(FindProposal[F](cfg.textAnalysis)) .flatMap(EvalProposals[F]) .flatMap(SaveProposals[F])