mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Apply folder restriction to fulltext only search
And update index when folder changes.
This commit is contained in:
@ -9,7 +9,7 @@ import docspell.backend.ops.OItemSearch._
|
||||
import docspell.common._
|
||||
import docspell.ftsclient._
|
||||
import docspell.store.Store
|
||||
import docspell.store.queries.QItem
|
||||
import docspell.store.queries.{QFolder, QItem}
|
||||
import docspell.store.queue.JobQueue
|
||||
import docspell.store.records.RJob
|
||||
|
||||
@ -101,12 +101,14 @@ object OFulltext {
|
||||
ftsQ.query,
|
||||
account.collective,
|
||||
Set.empty,
|
||||
Set.empty,
|
||||
batch.limit,
|
||||
batch.offset,
|
||||
FtsQuery.HighlightSetting(ftsQ.highlightPre, ftsQ.highlightPost)
|
||||
)
|
||||
for {
|
||||
ftsR <- fts.search(fq)
|
||||
folders <- store.transact(QFolder.getMemberFolders(account))
|
||||
ftsR <- fts.search(fq.withFolders(folders))
|
||||
ftsItems = ftsR.results.groupBy(_.itemId)
|
||||
select = ftsR.results.map(r => QItem.SelectedItem(r.itemId, r.score)).toSet
|
||||
itemsWithTags <-
|
||||
@ -184,6 +186,7 @@ object OFulltext {
|
||||
ftsQ.query,
|
||||
q.account.collective,
|
||||
Set.empty,
|
||||
Set.empty,
|
||||
0,
|
||||
0,
|
||||
FtsQuery.HighlightSetting(ftsQ.highlightPre, ftsQ.highlightPost)
|
||||
|
@ -142,6 +142,9 @@ object OItem {
|
||||
.transact(RItem.updateFolder(item, collective, folder))
|
||||
.attempt
|
||||
.map(AddResult.fromUpdate)
|
||||
.flatTap(
|
||||
onSuccessIgnoreError(fts.updateFolder(logger, item, collective, folder))
|
||||
)
|
||||
|
||||
def setCorrOrg(item: Ident, org: Option[Ident], collective: Ident): F[AddResult] =
|
||||
store
|
||||
|
Reference in New Issue
Block a user