mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Fixes searching items with fulltext
When using fulltext only search, then only the index must be searched. This wasn't working anymore, because the routes added a query to always select valid items (those not being processed). But this lead to the downstream code to always consult the database, too. Since the routes are using a "simple-search" interface, this is now adding the valid-state condition if applicable. There are still more low-level interfaces that can be used when searching should be done differently. Closes: #823
This commit is contained in:
@ -24,6 +24,9 @@ case class Query(fix: Query.Fix, cond: Query.QueryCond) {
|
||||
|
||||
object Query {
|
||||
|
||||
def apply(fix: Fix): Query =
|
||||
Query(fix, QueryExpr(None))
|
||||
|
||||
case class Fix(
|
||||
account: AccountId,
|
||||
query: Option[ItemQuery.Expr],
|
||||
@ -32,6 +35,9 @@ object Query {
|
||||
|
||||
def isEmpty: Boolean =
|
||||
query.isEmpty
|
||||
|
||||
def andQuery(expr: ItemQuery.Expr): Fix =
|
||||
copy(query = query.map(e => ItemQuery.Expr.and(e, expr)).orElse(Some(expr)))
|
||||
}
|
||||
|
||||
sealed trait QueryCond {
|
||||
|
Reference in New Issue
Block a user