Pass language when updating fulltext index

This commit is contained in:
eikek
2022-03-20 13:14:07 +01:00
parent f2a2d15e7f
commit b2add008ed
7 changed files with 72 additions and 22 deletions

View File

@ -576,7 +576,8 @@ object QItem {
collective: Ident,
folder: Option[Ident],
name: String,
notes: Option[String]
notes: Option[String],
language: Language
)
def allNameAndNotes(
coll: Option[Ident],
@ -584,10 +585,11 @@ object QItem {
chunkSize: Int
): Stream[ConnectionIO, NameAndNotes] = {
val i = RItem.as("i")
val c = RCollective.as("c")
Select(
select(i.id, i.cid, i.folder, i.name, i.notes),
from(i)
select(i.id, i.cid, i.folder, i.name, i.notes, c.language),
from(i).innerJoin(c, c.id === i.cid)
).where(
i.state.in(ItemState.validStates) &&?
itemIds.map(ids => i.id.in(ids)) &&?

View File

@ -236,8 +236,18 @@ object RAttachment {
n3 <- DML.delete(T, T.id === attachId)
} yield n0 + n1 + n2 + n3
def findItemId(attachId: Ident): ConnectionIO[Option[Ident]] =
Select(T.itemId.s, from(T), T.id === attachId).build.query[Ident].option
def findItemAndLanguage(
attachId: Ident
): ConnectionIO[Option[(Ident, Option[Language])]] = {
val a = RAttachment.as("a")
val m = RAttachmentMeta.as("m")
Select(
select(a.itemId, m.language),
from(a).leftJoin(m, m.id === a.id),
a.id === attachId
).build.query[(Ident, Option[Language])].option
}
def findAll(
coll: Option[Ident],