mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-07 07:35:59 +00:00
Return classifier results as suggestions
This commit is contained in:
parent
75573c905e
commit
3ff9284a64
@ -119,7 +119,7 @@ object QAttachment {
|
|||||||
|
|
||||||
def getMetaProposals(itemId: Ident, coll: Ident): ConnectionIO[MetaProposalList] = {
|
def getMetaProposals(itemId: Ident, coll: Ident): ConnectionIO[MetaProposalList] = {
|
||||||
val q = Select(
|
val q = Select(
|
||||||
am.proposals.s,
|
select(am.proposals, am.classifyProposals),
|
||||||
from(am)
|
from(am)
|
||||||
.innerJoin(a, a.id === am.id)
|
.innerJoin(a, a.id === am.id)
|
||||||
.innerJoin(item, a.itemId === item.id),
|
.innerJoin(item, a.itemId === item.id),
|
||||||
@ -127,8 +127,15 @@ object QAttachment {
|
|||||||
).build
|
).build
|
||||||
|
|
||||||
for {
|
for {
|
||||||
ml <- q.query[MetaProposalList].to[Vector]
|
ml <- q.query[(MetaProposalList, Option[MetaProposalList])].to[Vector]
|
||||||
} yield MetaProposalList.flatten(ml)
|
pairs = ml.foldLeft(
|
||||||
|
(Vector.empty[MetaProposalList], Vector.empty[MetaProposalList])
|
||||||
|
) { case ((vl, vr), (m, o)) =>
|
||||||
|
(vl.appended(m), o.map(vr.appended).getOrElse(vr))
|
||||||
|
}
|
||||||
|
} yield MetaProposalList
|
||||||
|
.flatten(pairs._1)
|
||||||
|
.fillEmptyFrom(MetaProposalList.flatten(pairs._2))
|
||||||
}
|
}
|
||||||
|
|
||||||
def getAttachmentMeta(
|
def getAttachmentMeta(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user