mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Use no-op fts-client if disabled + push this flag to the webui
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package docspell.ftsclient
|
||||
|
||||
import fs2.Stream
|
||||
import cats.implicits._
|
||||
import cats.effect._
|
||||
import org.log4s.getLogger
|
||||
import docspell.common._
|
||||
|
||||
/** The fts client is the interface for docspell to a fulltext search
|
||||
@ -90,3 +93,29 @@ trait FtsClient[F[_]] {
|
||||
def clear(logger: Logger[F], collective: Ident): F[Unit]
|
||||
|
||||
}
|
||||
|
||||
object FtsClient {
|
||||
|
||||
def none[F[_]: Sync] =
|
||||
new FtsClient[F] {
|
||||
private[this] val logger = Logger.log4s[F](getLogger)
|
||||
|
||||
def initialize: F[Unit] =
|
||||
logger.info("Full-text search is disabled!")
|
||||
|
||||
def search(q: FtsQuery): F[FtsResult] =
|
||||
logger.warn("Full-text search is disabled!") *> FtsResult.empty.pure[F]
|
||||
|
||||
def updateIndex(logger: Logger[F], data: Stream[F, TextData]): F[Unit] =
|
||||
logger.warn("Full-text search is disabled!")
|
||||
|
||||
def indexData(logger: Logger[F], data: Stream[F, TextData]): F[Unit] =
|
||||
logger.warn("Full-text search is disabled!")
|
||||
|
||||
def clearAll(logger: Logger[F]): F[Unit] =
|
||||
logger.warn("Full-text search is disabled!")
|
||||
|
||||
def clear(logger: Logger[F], collective: Ident): F[Unit] =
|
||||
logger.warn("Full-text search is disabled!")
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import docspell.common._
|
||||
final case class FtsQuery(
|
||||
q: String,
|
||||
collective: Ident,
|
||||
items: List[Ident],
|
||||
items: Set[Ident],
|
||||
limit: Int,
|
||||
offset: Int
|
||||
) {
|
||||
|
@ -14,6 +14,9 @@ final case class FtsResult(
|
||||
|
||||
object FtsResult {
|
||||
|
||||
val empty =
|
||||
FtsResult(Duration.millis(0), 0, 0.0, Map.empty, Nil)
|
||||
|
||||
sealed trait MatchData
|
||||
case class AttachmentData(attachId: Ident) extends MatchData
|
||||
case object ItemData extends MatchData
|
||||
|
Reference in New Issue
Block a user