mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Send no fts query if it is disabled
This commit is contained in:
@ -147,7 +147,7 @@ object OSearch {
|
||||
case Some(ftq) =>
|
||||
for {
|
||||
timed <- Duration.stopTime[F]
|
||||
ftq <- createFtsQuery(q.fix.account, batch, ftq)
|
||||
ftq <- createFtsQuery(q.fix.account, ftq)
|
||||
|
||||
results <- WeakAsync.liftK[F, ConnectionIO].use { nat =>
|
||||
val tempTable = temporaryFtsTable(ftq, nat)
|
||||
@ -206,7 +206,7 @@ object OSearch {
|
||||
fulltextQuery match {
|
||||
case Some(ftq) =>
|
||||
for {
|
||||
ftq <- createFtsQuery(q.fix.account, Batch.limit(500), ftq)
|
||||
ftq <- createFtsQuery(q.fix.account, ftq)
|
||||
results <- WeakAsync.liftK[F, ConnectionIO].use { nat =>
|
||||
val tempTable = temporaryFtsTable(ftq, nat)
|
||||
store.transact(
|
||||
@ -221,13 +221,12 @@ object OSearch {
|
||||
|
||||
private def createFtsQuery(
|
||||
account: AccountId,
|
||||
batch: Batch,
|
||||
ftq: String
|
||||
): F[FtsQuery] =
|
||||
store
|
||||
.transact(QFolder.getMemberFolders(account))
|
||||
.map(folders =>
|
||||
FtsQuery(ftq, account.collective, batch.limit, 0)
|
||||
FtsQuery(ftq, account.collective, 500, 0)
|
||||
.withFolders(folders)
|
||||
)
|
||||
|
||||
|
@ -20,6 +20,11 @@ sealed trait QueryParseResult {
|
||||
object QueryParseResult {
|
||||
|
||||
final case class Success(q: Query, ftq: Option[String]) extends QueryParseResult {
|
||||
|
||||
/** Drop the fulltext search query if disabled. */
|
||||
def withFtsEnabled(enabled: Boolean) =
|
||||
if (enabled || ftq.isEmpty) this else copy(ftq = None)
|
||||
|
||||
val get = Some(q -> ftq)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user