mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Refactor search to separate between a base query and user query
The `findBase` is adding only strictly required conditions. Everything else comes from the user.
This commit is contained in:
@ -164,7 +164,7 @@ object OFulltext {
|
||||
.flatMap(r => Stream.emits(r.results.map(_.itemId)))
|
||||
.compile
|
||||
.to(Set)
|
||||
q = Query.empty(account).copy(itemIds = itemIds.some)
|
||||
q = Query.empty(account).withCond(_.copy(itemIds = itemIds.some))
|
||||
res <- store.transact(QItem.searchStats(q))
|
||||
} yield res
|
||||
}
|
||||
@ -208,7 +208,7 @@ object OFulltext {
|
||||
search <- itemSearch.findItems(0)(q, Batch.all)
|
||||
fq = FtsQuery(
|
||||
ftsQ.query,
|
||||
q.account.collective,
|
||||
q.fix.account.collective,
|
||||
search.map(_.id).toSet,
|
||||
Set.empty,
|
||||
500,
|
||||
@ -220,7 +220,7 @@ object OFulltext {
|
||||
.flatMap(r => Stream.emits(r.results.map(_.itemId)))
|
||||
.compile
|
||||
.to(Set)
|
||||
qnext = q.copy(itemIds = items.some)
|
||||
qnext = q.withCond(_.copy(itemIds = items.some))
|
||||
res <- store.transact(QItem.searchStats(qnext))
|
||||
} yield res
|
||||
|
||||
@ -253,7 +253,7 @@ object OFulltext {
|
||||
val sqlResult = search(q, batch)
|
||||
val fq = FtsQuery(
|
||||
ftsQ.query,
|
||||
q.account.collective,
|
||||
q.fix.account.collective,
|
||||
Set.empty,
|
||||
Set.empty,
|
||||
0,
|
||||
|
@ -138,7 +138,9 @@ object OItemSearch {
|
||||
val search = QItem.findItems(q, maxNoteLen: Int, batch)
|
||||
store
|
||||
.transact(
|
||||
QItem.findItemsWithTags(q.account.collective, search).take(batch.limit.toLong)
|
||||
QItem
|
||||
.findItemsWithTags(q.fix.account.collective, search)
|
||||
.take(batch.limit.toLong)
|
||||
)
|
||||
.compile
|
||||
.toVector
|
||||
|
Reference in New Issue
Block a user