mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Add backend operations for re-creating the full-text index
This commit is contained in:
@ -147,7 +147,10 @@ object QAttachment {
|
||||
name: Option[String],
|
||||
content: Option[String]
|
||||
)
|
||||
def allAttachmentMetaAndName(chunkSize: Int): Stream[ConnectionIO, ContentAndName] = {
|
||||
def allAttachmentMetaAndName(
|
||||
coll: Option[Ident],
|
||||
chunkSize: Int
|
||||
): Stream[ConnectionIO, ContentAndName] = {
|
||||
val aId = RAttachment.Columns.id.prefix("a")
|
||||
val aItem = RAttachment.Columns.itemId.prefix("a")
|
||||
val aName = RAttachment.Columns.name.prefix("a")
|
||||
@ -164,7 +167,9 @@ object QAttachment {
|
||||
fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ iId.is(aItem) ++
|
||||
fr"INNER JOIN" ++ RCollective.table ++ fr"c ON" ++ cId.is(iColl)
|
||||
|
||||
selectSimple(cols, from, Fragment.empty)
|
||||
val where = coll.map(cid => iColl.is(cid)).getOrElse(Fragment.empty)
|
||||
|
||||
selectSimple(cols, from, where)
|
||||
.query[ContentAndName]
|
||||
.streamWithChunkSize(chunkSize)
|
||||
}
|
||||
|
@ -475,14 +475,18 @@ object QItem {
|
||||
name: String,
|
||||
notes: Option[String]
|
||||
)
|
||||
def allNameAndNotes(chunkSize: Int): Stream[ConnectionIO, NameAndNotes] = {
|
||||
def allNameAndNotes(
|
||||
coll: Option[Ident],
|
||||
chunkSize: Int
|
||||
): Stream[ConnectionIO, NameAndNotes] = {
|
||||
val iId = RItem.Columns.id
|
||||
val iColl = RItem.Columns.cid
|
||||
val iName = RItem.Columns.name
|
||||
val iNotes = RItem.Columns.notes
|
||||
|
||||
val cols = Seq(iId, iColl, iName, iNotes)
|
||||
selectSimple(cols, RItem.table, Fragment.empty)
|
||||
val cols = Seq(iId, iColl, iName, iNotes)
|
||||
val where = coll.map(cid => iColl.is(cid)).getOrElse(Fragment.empty)
|
||||
selectSimple(cols, RItem.table, where)
|
||||
.query[NameAndNotes]
|
||||
.streamWithChunkSize(chunkSize)
|
||||
}
|
||||
|
Reference in New Issue
Block a user