Introducing fts client into codebase

This commit is contained in:
Eike Kettner
2020-06-17 00:24:23 +02:00
parent ee801745a7
commit 522daaf57e
21 changed files with 327 additions and 73 deletions

View File

@ -84,6 +84,10 @@ docspell.server {
}
}
fulltext-search {
enabled = true
}
# Configuration for the backend.
backend {
# Enable or disable debugging for e-mail related functionality. This
@ -143,5 +147,13 @@ docspell.server {
# By default all files are allowed.
valid-mime-types = [ ]
}
# Configuration of the full-text search engine.
full-text-search {
enabled = true
solr = {
url = "http://localhost:8983/solr/docspell_core"
}
}
}
}

View File

@ -13,7 +13,8 @@ case class Config(
backend: BackendConfig,
auth: Login.Config,
integrationEndpoint: Config.IntegrationEndpoint,
maxItemPageSize: Int
maxItemPageSize: Int,
fulltextSearch: Config.FulltextSearch
)
object Config {
@ -50,4 +51,9 @@ object Config {
}
}
}
case class FulltextSearch(enabled: Boolean)
object FulltextSearch {}
}

View File

@ -124,7 +124,7 @@ trait Conversions {
m.dueDateFrom,
m.dueDateUntil,
m.allNames,
m.fullText,
None,
None
)

View File

@ -47,10 +47,19 @@ object ItemRoutes {
_ <- logger.ftrace(s"Got search mask: $mask")
query = Conversions.mkQuery(mask, user.account.collective)
_ <- logger.ftrace(s"Running query: $query")
items <- backend.itemSearch.findItemsWithTags(
query,
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
)
items <- mask.fullText match {
case None =>
backend.itemSearch.findItemsWithTags(
query,
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
)
case Some(fq) =>
backend.fulltext.findItemsWithTags(
query,
fq,
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
)
}
resp <- Ok(Conversions.mkItemListWithTags(items))
} yield resp