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:
Eike Kettner
2021-05-23 01:16:44 +02:00
parent d9ed4b7bd5
commit a1a93e5ca6
9 changed files with 202 additions and 114 deletions

View File

@ -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 {